Fixing URLs for cave descriptions

This commit is contained in:
Philip Sargent
2022-03-18 20:00:15 +00:00
parent 6f32364675
commit 6a18511dd0
9 changed files with 110 additions and 82 deletions

View File

@@ -158,14 +158,30 @@ class PageTests(TestCase):
self.assertEqual(len(response.content), 6057)
def test_cave_kataster_not_found(self):
# database not loaded, so no caves found
response = self.client.get('/cave/115')
self.assertEqual(response.status_code, 200)
# database not loaded, so no caves found; so looks for a generic expopage and fails
response = self.client.get('/1623/115.htm')
self.assertEqual(response.status_code, 404)
content = response.content.decode()
ph = r"Cave Identifier not found in database"
ph = r"Page not found 1623/115.htm"
phmatch = re.search(ph, content)
self.assertIsNotNone(phmatch, "Failed to find expected text: '" + ph +"'")
def test_caves_page(self):
response = self.client.get('/caves')
self.assertEqual(response.status_code, 200)
content = response.content.decode()
ph = r"Cave Number Index - kept updated"
phmatch = re.search(ph, content)
self.assertIsNotNone(phmatch, "Failed to find expected text: '" + ph +"'")
def test_caves_page_kataster_not_found(self):
response = self.client.get('/caves')
self.assertEqual(response.status_code, 200)
content = response.content.decode()
ph = r"115"
phmatch = re.search(ph, content)
self.assertIsNone(phmatch, "Failed to find expected text: '" + ph +"'")
def test_page_ss(self):
response = self.client.get('/survey_scans/')
self.assertEqual(response.status_code, 200)