mirror of
https://github.com/TrentSPalmer/trentpalmerdotorg.git
synced 2024-11-22 01:21:30 -08:00
update audio/tests/test_new_episode_view.py add function
test_new_episode_view_get()
This commit is contained in:
parent
72ceb18fdd
commit
99dc32fa93
@ -11,6 +11,21 @@ class TestNewEpisodeViewTestCase(TestCase):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
set_up()
|
set_up()
|
||||||
|
|
||||||
|
def test_new_episode_view_get(self):
|
||||||
|
feed_a = Feed.objects.get(title="Short Stories Mark Twain")
|
||||||
|
self.client.login(username='user_b', password='password_user_b')
|
||||||
|
kw_args = {'feed_pk': feed_a.pk, 'feed_title_slug': feed_a.slug}
|
||||||
|
response = self.client.get(reverse('audio:new_episode', kwargs=kw_args))
|
||||||
|
self.assertEquals(response.status_code, 200)
|
||||||
|
self.assertTemplateUsed(response, 'base_form.html')
|
||||||
|
self.assertFalse(Episode.objects.filter(
|
||||||
|
title="Mark Twain Taming The Bicycle",
|
||||||
|
).exists())
|
||||||
|
self.assertEquals(
|
||||||
|
response.request['PATH_INFO'],
|
||||||
|
f'/new-episode/{feed_a.pk}/{feed_a.slug}'
|
||||||
|
)
|
||||||
|
|
||||||
def test_new_episode_view_wrong_user(self):
|
def test_new_episode_view_wrong_user(self):
|
||||||
feed_a = Feed.objects.get(title="Short Stories Mark Twain")
|
feed_a = Feed.objects.get(title="Short Stories Mark Twain")
|
||||||
self.client.login(username='user_a', password='password_user_a')
|
self.client.login(username='user_a', password='password_user_a')
|
||||||
@ -37,7 +52,8 @@ class TestNewEpisodeViewTestCase(TestCase):
|
|||||||
}, follow=True)
|
}, follow=True)
|
||||||
self.assertEquals(response.status_code, 200)
|
self.assertEquals(response.status_code, 200)
|
||||||
self.assertFalse(Episode.objects.filter(
|
self.assertFalse(Episode.objects.filter(
|
||||||
title="Mark Twain Taming The Bicycle").exists())
|
title="Mark Twain Taming The Bicycle",
|
||||||
|
).exists())
|
||||||
self.assertEquals(response.request['PATH_INFO'], '/')
|
self.assertEquals(response.request['PATH_INFO'], '/')
|
||||||
self.assertTemplateUsed(response, 'audio/index.html')
|
self.assertTemplateUsed(response, 'audio/index.html')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user