summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/TESTS/test_caves.py46
-rw-r--r--core/TESTS/test_logins.py4
-rw-r--r--core/TESTS/test_parsers.py8
3 files changed, 43 insertions, 15 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 + "'")
+
diff --git a/core/TESTS/test_logins.py b/core/TESTS/test_logins.py
index 7bfd065..ef9478b 100644
--- a/core/TESTS/test_logins.py
+++ b/core/TESTS/test_logins.py
@@ -151,8 +151,8 @@ class PostTests(TestCase):
)
content = response.content.decode()
self.assertEqual(response.status_code, HTTPStatus.OK)
- with open("_test_response.html", "w") as f:
- f.write(content)
+ # with open("_test_response.html", "w") as f:
+ # f.write(content)
for ph in [
r"test_upload_",
rf"← {testyear}#00 →",
diff --git a/core/TESTS/test_parsers.py b/core/TESTS/test_parsers.py
index 2d951bc..70f19cd 100644
--- a/core/TESTS/test_parsers.py
+++ b/core/TESTS/test_parsers.py
@@ -118,8 +118,8 @@ class ImportTest(TestCase):
response = self.client.get("/survexfile/caves/")
self.assertEqual(response.status_code, HTTPStatus.OK)
content = response.content.decode()
- with open('_test_response.html', 'w') as f:
- f.write(content)
+ # with open('_test_response.html', 'w') as f:
+ # f.write(content)
ph = f"Caves with subdirectories"
phmatch = re.search(ph, content)
self.assertIsNotNone(phmatch, "Failed to find expected text: '" + ph + "'")
@@ -130,8 +130,8 @@ class ImportTest(TestCase):
response = self.client.get("/people")
self.assertEqual(response.status_code, HTTPStatus.OK)
content = response.content.decode()
- with open('_test_response.html', 'w') as f:
- f.write(content)
+ # with open('_test_response.html', 'w') as f:
+ # f.write(content)
ph = f"<td><a href=\"/personexpedition/FredSmartarse/{TEST_YEAR}\">{TEST_YEAR}</a></td>"
phmatch = re.search(ph, content)
self.assertIsNotNone(phmatch, "Failed to find expected text: '" + ph + "'")