update audio/tests/test_edit_episode_view.py add function

test_edit_episode_view_wrong_user()
This commit is contained in:
Trent Palmer 2021-04-22 16:57:44 -07:00
parent 997b8890d2
commit 2d3f2cb56f

View File

@ -9,6 +9,33 @@ class TestEditEpisodeViewTestCase(TestCase):
def setUp(self): def setUp(self):
set_up() set_up()
def test_edit_episode_view_wrong_user(self):
episode_a = Episode.objects.get(title="Mark Twain The Bee")
self.client.login(username='user_a', password='password_user_a')
kw_args = {'pk': episode_a.pk, 'title_slug': episode_a.slug}
response = self.client.post(reverse('audio:edit_episode', kwargs=kw_args), {
'title': episode_a.title,
'author': "Mark Twain",
'pub_date': episode_a.pub_date,
'episode_number': 2,
'description': "An essay about the human quality of bees.",
'image_title': "Stenotritus pubescens",
'image_attribution': "USGS Bee Inventory and Monitoring Lab",
'original_image_url': "https://www.flickr.com/photos/usgsbiml/14589580124/",
'image_license': 1,
'image_license_jurisdiction': "in the United States",
}, follow=True)
self.assertEquals(response.status_code, 200)
episode_ab = Episode.objects.get(title="Mark Twain The Bee")
self.assertEquals(episode_ab.author, "")
self.assertIsNone(episode_ab.episode_number)
self.assertEquals(episode_ab.description, "")
self.assertEquals(episode_ab.image_attribution, "")
self.assertEquals(episode_ab.original_image_url, "")
self.assertEquals(episode_ab.image_license, 2)
self.assertEquals(episode_ab.image_license_jurisdiction, "(no jurisdiction specified)")
self.assertEquals(response.request['PATH_INFO'], '/')
def test_edit_episode_view(self): def test_edit_episode_view(self):
episode_a = Episode.objects.get(title="Mark Twain The Bee") episode_a = Episode.objects.get(title="Mark Twain The Bee")
self.client.login(username='user_b', password='password_user_b') self.client.login(username='user_b', password='password_user_b')