mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-15 21:17:07 +00:00
more tests
This commit is contained in:
@@ -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"
|
||||
phmatch = re.search(ph, 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"
|
||||
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_cavehtml284(self):
|
||||
response = self.client.get("/1623/284/284.html")
|
||||
self.assertEqual(response.status_code, HTTPStatus.OK)
|
||||
content = response.content.decode()
|
||||
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 + "'")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user