summaryrefslogtreecommitdiffstats
path: root/core/TESTS/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'core/TESTS/tests.py')
-rw-r--r--core/TESTS/tests.py21
1 files changed, 12 insertions, 9 deletions
diff --git a/core/TESTS/tests.py b/core/TESTS/tests.py
index 7936fb0..b8b915d 100644
--- a/core/TESTS/tests.py
+++ b/core/TESTS/tests.py
@@ -60,7 +60,7 @@ class SimpleTest(SimpleTestCase):
from troggle.core.models import Expedition
from troggle.core.models_caves import CaveSlug, Cave, CaveAndEntrance, QM, EntranceSlug, Entrance, Area, SurvexStation
from troggle.core.forms import CaveForm, CaveAndEntranceFormSet, VersionControlCommentForm, EntranceForm, EntranceLetterForm
- from troggle.helper import login_required_if_public
+ from troggle.core.views.login import login_required_if_public
from django.contrib.auth.decorators import login_required
from django.conf import settings
def test_import_parsers_mix(self):
@@ -92,6 +92,9 @@ class SimpleTest(SimpleTestCase):
#class SimplePageTest(unittest.TestCase):
class PageTests(TestCase):
+ '''These tests may appear to be redundant, but in fact they exercise different bits of code. The urls.py
+ dispatcher is sending these URLs view via different 'view' handlers, and they all need verifying.
+ '''
@classmethod
def setUpTestData(cls):
# Set up data for the whole TestCase
@@ -112,14 +115,6 @@ class PageTests(TestCase):
phmatch = re.search(ph, content)
self.assertIsNotNone(phmatch, "Failed to find expected text: '" + ph +"'")
- def test_expoweb_root(self):
- response = self.client.get('')
- content = response.content.decode()
- self.assertEqual(response.status_code, 200)
- ph = r'CUCC in Austria'
- phmatch = re.search(ph, content)
- self.assertIsNotNone(phmatch, "Failed to find expected text: '" + ph +"'")
-
def test_expoweb_root_slash(self):
response = self.client.get('/')
content = response.content.decode()
@@ -177,6 +172,11 @@ class PageTests(TestCase):
phmatch = re.search(ph, content)
self.assertIsNotNone(phmatch, "Failed to find expected text: '" + ph +"'")
+ def test_expoweb_via_areaid(self):
+ # the dispatcher takes a detour via the cave renering procedure for this
+ response = self.client.get('/1623/others/t/via201.jpg')
+ self.assertEqual(response.status_code, 200)
+ self.assertEqual(len(response.content), 6057)
def test_cave_kataster_not_found(self):
# database not loaded, so no caves found
@@ -378,6 +378,9 @@ class PageTests(TestCase):
phmatch = re.search(ph, content)
self.assertIsNotNone(phmatch, "Failed to find expected text: '" + ph +"'")
+# ADD TESTS when we are redirecting /expofiles/ to get the actual files using e.g.
+# import requests
+# page = requests.get("http://dataquestio.github.io/web-scraping-pages/simple.html")
# these need a fixture to load the datbase before they will pass
# we also need tests for invalid queries to check that error pages are right