Skip to content

Commit

Permalink
fix testing in Python 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrDlouhy committed Jan 23, 2024
1 parent a693b0a commit a1e259a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions categories/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,27 @@ def test_category_detail(self):
cat2 = Category.objects.get(slug="urban-cowboy")
url = cat0.get_absolute_url()
response = self.client.get(url)
self.assertEquals(response.status_code, 200)
self.assertEqual(response.status_code, 200)
url = cat1.get_absolute_url()
response = self.client.get(url)
self.assertEquals(response.status_code, 200)
self.assertEqual(response.status_code, 200)
url = cat2.get_absolute_url()
response = self.client.get(url)
self.assertEquals(response.status_code, 200)
self.assertEqual(response.status_code, 200)
response = self.client.get("%sfoo/" % url)
self.assertEquals(response.status_code, 404)
self.assertEqual(response.status_code, 404)

def test_get_category_for_path(self):
cat0 = Category.objects.get(slug="country", level=0)
cat1 = cat0.children.get(slug="country-pop")
cat2 = Category.objects.get(slug="urban-cowboy")

result = views.get_category_for_path("/country/country-pop/urban-cowboy/")
self.assertEquals(result, cat2)
self.assertEqual(result, cat2)
result = views.get_category_for_path("/country/country-pop/")
self.assertEquals(result, cat1)
self.assertEqual(result, cat1)
result = views.get_category_for_path("/country/")
self.assertEquals(result, cat0)
self.assertEqual(result, cat0)

def test_categorydetailview(self):
request = self.factory.get("")
Expand All @@ -55,7 +55,7 @@ def test_categorydetailview(self):
request = self.factory.get("")
request.user = AnonymousUser()
response = views.CategoryDetailView.as_view()(request, path="/country/country-pop/urban-cowboy/")
self.assertEquals(response.status_code, 200)
self.assertEqual(response.status_code, 200)

request = self.factory.get("")
request.user = AnonymousUser()
Expand All @@ -74,7 +74,7 @@ def test_categoryrelateddetailview(self):
request = self.factory.get("")
request.user = AnonymousUser()
response = MyCategoryRelationView.as_view()(request, category_path="/country/country-pop/urban-cowboy/")
self.assertEquals(response.status_code, 200)
self.assertEqual(response.status_code, 200)

request = self.factory.get("")
request.user = AnonymousUser()
Expand Down

0 comments on commit a1e259a

Please sign in to comment.