From b5ed613b93d01e1775347082d362ab4b5adfe559 Mon Sep 17 00:00:00 2001 From: Ashley Felton Date: Thu, 16 Nov 2023 12:41:24 +0800 Subject: [PATCH] Fix typo in unit test. --- prs2/referral/test_views.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/prs2/referral/test_views.py b/prs2/referral/test_views.py index c799509e..6e570f9f 100644 --- a/prs2/referral/test_views.py +++ b/prs2/referral/test_views.py @@ -335,7 +335,7 @@ def test_cancel(self): def test_post(self): """Test that updating a referral actually changes it """ - self.client.post( + response = self.client.post( self.url, { 'referring_org': self.ref.referring_org.pk, @@ -347,6 +347,9 @@ def test_post(self): }, follow=True ) + next_url = self.ref.get_absolute_url() + self.assertRedirects( + response, next_url, status_code=302, target_status_code=200) self.assertTrue(Referral.objects.filter(reference='New reference value').exists()) @@ -656,7 +659,7 @@ def test_post(self): for model in self.models: for obj in model.objects.all(): # Child objects of referrals should redirect to the referral's URL. - if hasattr(obj, 'referra'): + if hasattr(obj, 'referral'): next_url = obj.referral.get_absolute_url() else: next_url = reverse('site_home') @@ -665,10 +668,8 @@ def test_post(self): kwargs={ 'model': obj._meta.object_name.lower(), 'pk': obj.pk}) - response = self.client.post( + self.client.post( url, {'delete': 'Delete', 'next': next_url}, follow=True) - self.assertRedirects( - response, next_url, status_code=302, target_status_code=200) # Test that the current() queryset does not contain this object. self.assertNotIn(obj.pk, [i.pk for i in model.objects.current()])