diff options
author | Philip Sargent <philip.sargent@klebos.com> | 2021-04-17 23:59:11 +0100 |
---|---|---|
committer | Philip Sargent <philip.sargent@klebos.com> | 2021-04-17 23:59:11 +0100 |
commit | eea74406c9ba0e7554a75e98ae7bb6792a164e11 (patch) | |
tree | dc0e2d091fef34aef3d66f6117c5b2694bf865c9 /core/TESTS/tests_caves.py | |
parent | d4317b5fd33961847fda17f3a94afb2f7414b657 (diff) | |
download | troggle-eea74406c9ba0e7554a75e98ae7bb6792a164e11.tar.gz troggle-eea74406c9ba0e7554a75e98ae7bb6792a164e11.tar.bz2 troggle-eea74406c9ba0e7554a75e98ae7bb6792a164e11.zip |
fix template bug for newentrance
Diffstat (limited to 'core/TESTS/tests_caves.py')
-rw-r--r-- | core/TESTS/tests_caves.py | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/core/TESTS/tests_caves.py b/core/TESTS/tests_caves.py index 84a0d97..2e05ce9 100644 --- a/core/TESTS/tests_caves.py +++ b/core/TESTS/tests_caves.py @@ -5,11 +5,13 @@ Modified for Expo April 2021. import unittest import re from django.test import TestCase, SimpleTestCase, TransactionTestCase, Client +from troggle.core.models.caves import Cave class FixturePageTests(TestCase): # The fixtures have a password hash which is compatible with plain-text password 'secretword' fixtures = ['auth_users', 'expo_areas', 'expo_caves'] + ph = r'and leads in 800m of tortuous going to' def setUp(self): from django.contrib.auth.models import User @@ -18,4 +20,25 @@ class FixturePageTests(TestCase): def tearDown(self): pass - + def test_fix_cave_loaded(self): + c = Cave.objects.get(kataster_number='115') + self.assertEqual(str(c.description_file), "1623/115.htm") + self.assertEqual(str(c.url), "1623/115.htm") + self.assertEqual(str(c.filename), "1623-115.html") + + ph = self.ph + phmatch = re.search(ph, c.underground_description) + self.assertIsNotNone(phmatch, "In fixture-loaded cave, failed to find expected text: '" + ph +"'") + + def test_fix_cave_url(self): + ph = self.ph + response = self.client.get('1623/115.htm') + #self.assertEqual(response.status_code, 200) + + content = response.content.decode() + phmatch = re.search(ph, content) + with open('cave-op.html', 'w') as f: + f.write(content) + self.assertIsNotNone(phmatch, "Failed to find expected text: '" + ph +"'") + +
\ No newline at end of file |