Skip to content

Commit

Permalink
Advert test
Browse files Browse the repository at this point in the history
  • Loading branch information
berk76 committed Dec 1, 2024
1 parent f789c70 commit 5ad48f1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions svjis/articles/tests/test_adverts.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@

class AdvertsTest(UserDataMixin, TestCase):

def create_advert(self, username, password, advert_form, status):
def create_advert(self, username, password, advert_form, expected_status):
logged_in = self.client.login(username=username, password=password)
self.assertTrue(logged_in)
response = self.client.post(
reverse('adverts_save'),
advert_form,
follow=False,
)
if status == 302:
self.assertEqual(response.status_code, status)
if expected_status == 302:
self.assertEqual(response.status_code, expected_status)
self.assertEqual(response.url, '/adverts_list/')
response = self.client.get(reverse('adverts_list'), follow=True)
self.assertEqual(response.status_code, 200)
Expand All @@ -26,7 +26,7 @@ def create_advert(self, username, password, advert_form, status):
advert = adverts[0]['advert']
return advert
else:
self.assertEqual(response.status_code, status)
self.assertEqual(response.status_code, expected_status)
return None

def test_hide_adverts_of_deactivated_user(self):
Expand Down

0 comments on commit 5ad48f1

Please sign in to comment.