diff options
author | Philip Sargent <philip.sargent@gmail.com> | 2023-04-06 00:51:04 +0100 |
---|---|---|
committer | Philip Sargent <philip.sargent@gmail.com> | 2023-04-06 00:51:04 +0100 |
commit | f15555a3bda2afbb5860cb303405cf5fcd51ea45 (patch) | |
tree | 8ffaf22d058dc4b6dd2e069979ca1dcf77032f34 /core/TESTS/test_caves.py | |
parent | dcfff1ede7d33c91a87f4874181156b46ec75589 (diff) | |
download | troggle-f15555a3bda2afbb5860cb303405cf5fcd51ea45.tar.gz troggle-f15555a3bda2afbb5860cb303405cf5fcd51ea45.tar.bz2 troggle-f15555a3bda2afbb5860cb303405cf5fcd51ea45.zip |
more tests
Diffstat (limited to 'core/TESTS/test_caves.py')
-rw-r--r-- | core/TESTS/test_caves.py | 46 |
1 files changed, 37 insertions, 9 deletions
diff --git a/core/TESTS/test_caves.py b/core/TESTS/test_caves.py index e35d360..d6e8bc7 100644 --- a/core/TESTS/test_caves.py +++ b/core/TESTS/test_caves.py @@ -9,7 +9,9 @@ from django.test import Client, TestCase from troggle.core.models.caves import Area, Cave from troggle.core.models.troggle import Person, PersonExpedition - + +# import troggle.settings as settings +# FIXTURE_DIRS = settings.PYTHON_PATH / "core" /"fixtures" class FixtureTests(TestCase): """These just hit the database. @@ -75,7 +77,8 @@ class FixtureTests(TestCase): class FixturePageTests(TestCase): """Currently nothing that runs troggle works - all do 404. Must be something in a template rendering crash? - ordinary pages are OK, and expopages and expofiles are OK, even though they come through troggle. + ordinary pages are OK, and expopages and expofiles are OK, even though they come through troggle. And the + fixtures are certainly loaded into the db as the other tests show. """ # The fixtures have a password hash which is compatible with plain-text password 'secretword' @@ -150,7 +153,7 @@ class FixturePageTests(TestCase): content = response.content.decode() phmatch = re.search(ph, content) - # with open('cave-op.html', 'w') as f: + # with open('cave-url284.html', 'w') as f: # f.write(content) self.assertIsNotNone(phmatch, "Failed to find expected text: '" + ph + "'") @@ -176,20 +179,45 @@ class FixturePageTests(TestCase): phmatch = re.search(ph, content) self.assertIsNotNone(phmatch, "Failed to find expected text: '" + ph + "'") # 200 & Page Not Found - def test_fix_qms(self): - response = self.client.get("/cave/qms/1623-284") + def test_fix_caves284(self): + response = self.client.get("/caves") self.assertEqual(response.status_code, HTTPStatus.OK) content = response.content.decode() - ph = r"Question marks for 284 - Seetrichter" + ph = r"284 Seetrichter" phmatch = re.search(ph, content) + # with open('_cave_fix_caves.html', 'w') as f: + # f.write(content) self.assertIsNotNone(phmatch, "Failed to find expected text: '" + ph + "'") - def test_fix_openqms(self): - response = self.client.get("/cave/openqms/1623-284") + + def test_fix_cavehtml284(self): + response = self.client.get("/1623/284/284.html") self.assertEqual(response.status_code, HTTPStatus.OK) content = response.content.decode() - ph = r"Open Leads for 284 - Seetrichter" + ph = r"A 25m long (22m deep) resurgence in Altausee" phmatch = re.search(ph, content) + with open('_cave_fix_cavehtml284.html', 'w') as f: + f.write(content) self.assertIsNotNone(phmatch, "Failed to find expected text: '" + ph + "'") + # def test_fix_qms(self): + # response = self.client.get("/cave/qms/1623-284") + # self.assertEqual(response.status_code, HTTPStatus.OK) + # content = response.content.decode() + # ph = r"Question marks for 284 - Seetrichter" + # phmatch = re.search(ph, content) + # with open('_cave-fixqms.html', 'w') as f: + # f.write(content) + # self.assertIsNotNone(phmatch, "Failed to find expected text: '" + ph + "'") + + # def test_fix_openqms(self): + # response = self.client.get("/cave/openqms/1623-284") + # self.assertEqual(response.status_code, HTTPStatus.OK) + # content = response.content.decode() + # ph = r"Open Leads for 284 - Seetrichter" + # phmatch = re.search(ph, content) + # with open('_cave-fixopenqms.html', 'w') as f: + # f.write(content) + # self.assertIsNotNone(phmatch, "Failed to find expected text: '" + ph + "'") + |