diff options
Diffstat (limited to 'core/TESTS/tests_caves.py')
-rw-r--r-- | core/TESTS/tests_caves.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/core/TESTS/tests_caves.py b/core/TESTS/tests_caves.py index 529c712..baa4ffa 100644 --- a/core/TESTS/tests_caves.py +++ b/core/TESTS/tests_caves.py @@ -3,6 +3,7 @@ Modified for Expo April 2021. """ import re +from http import HTTPStatus from django.test import Client, TestCase @@ -65,7 +66,7 @@ class FixtureTests(TestCase): content = response.content.decode() # with open('testresponse.html','w') as tr: # tr.writelines(content) - self.assertEqual(response.status_code, 200) + self.assertEqual(response.status_code, HTTPStatus.OK) for ph in [r"Michael Sargent", r"Table of all trips and surveys aligned by date"]: phmatch = re.search(ph, content) self.assertIsNotNone(phmatch, "Failed to find expected text: '" + ph + "'") @@ -98,7 +99,7 @@ class FixturePageTests(TestCase): def test_fix_expedition(self): response = self.client.get("/expedition/2019") - self.assertEqual(response.status_code, 200) + self.assertEqual(response.status_code, HTTPStatus.OK) ph = r"Michael Sargent" @@ -110,7 +111,7 @@ class FixturePageTests(TestCase): def test_fix_personexped(self): response = self.client.get("/personexpedition/MichaelSargent/2019") - self.assertEqual(response.status_code, 200) + self.assertEqual(response.status_code, HTTPStatus.OK) ph = r"Table of all trips and surveys aligned by date" @@ -122,7 +123,7 @@ class FixturePageTests(TestCase): def test_fix_person(self): response = self.client.get("/person/MichaelSargent") - self.assertEqual(response.status_code, 200) + self.assertEqual(response.status_code, HTTPStatus.OK) ph = r"second-generation expo caver " @@ -135,7 +136,7 @@ class FixturePageTests(TestCase): def test_fix_cave_url115(self): ph = self.ph response = self.client.get("/1623/115.url") # yes this is intentional, see the inserted data above & fixture - self.assertEqual(response.status_code, 200) + self.assertEqual(response.status_code, HTTPStatus.OK) content = response.content.decode() phmatch = re.search(ph, content) @@ -143,7 +144,7 @@ class FixturePageTests(TestCase): def test_fix_cave_url284(self): response = self.client.get("/1623/284/284.html") - self.assertEqual(response.status_code, 200) + self.assertEqual(response.status_code, HTTPStatus.OK) ph = r"at a depth of 72m, there are large round blocks" @@ -158,7 +159,7 @@ class FixturePageTests(TestCase): ph = self.ph ph = "Probably a mistake." response = self.client.get("/1623/115") - self.assertEqual(response.status_code, 404) + self.assertEqual(response.status_code, HTTPStatus.NOT_FOUND) content = response.content.decode() phmatch = re.search(ph, content) @@ -169,7 +170,7 @@ class FixturePageTests(TestCase): ph = self.ph ph = "Probably a mistake." response = self.client.get("/1623-115") - self.assertEqual(response.status_code, 404) + self.assertEqual(response.status_code, HTTPStatus.NOT_FOUND) content = response.content.decode() phmatch = re.search(ph, content) |