mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-21 23:01:52 +00:00
fix pointless error messages in tests
This commit is contained in:
parent
2787b6c4ec
commit
e6601e1bf7
@ -8,6 +8,8 @@ from http import HTTPStatus
|
|||||||
from django.test import Client, TestCase
|
from django.test import Client, TestCase
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
|
|
||||||
|
import settings
|
||||||
|
|
||||||
from troggle.core.models.caves import Cave
|
from troggle.core.models.caves import Cave
|
||||||
from troggle.core.models.troggle import Person, PersonExpedition, Expedition
|
from troggle.core.models.troggle import Person, PersonExpedition, Expedition
|
||||||
from troggle.core.utils import current_expo
|
from troggle.core.utils import current_expo
|
||||||
@ -24,6 +26,11 @@ def create_user(name=None, last_name="Caver", is_superuser=False):
|
|||||||
u.save()
|
u.save()
|
||||||
return u
|
return u
|
||||||
|
|
||||||
|
def create_cave(areacode="1623", kataster_number="000", official_name=""):
|
||||||
|
c = Cave(areacode=areacode, kataster_number=kataster_number, official_name=official_name)
|
||||||
|
c.save()
|
||||||
|
return c
|
||||||
|
|
||||||
# import troggle.settings as settings
|
# import troggle.settings as settings
|
||||||
# FIXTURE_DIRS = settings.PYTHON_PATH / "core" /"fixtures"
|
# FIXTURE_DIRS = settings.PYTHON_PATH / "core" /"fixtures"
|
||||||
|
|
||||||
@ -102,14 +109,10 @@ class FixtureTests(TestCase):
|
|||||||
|
|
||||||
|
|
||||||
class FixturePageTests(TestCase):
|
class FixturePageTests(TestCase):
|
||||||
"""Currently nothing that runs troggle works - all do 404. Must be something in a template rendering crash?
|
"""The fixtures have a password hash which is compatible with plain-text password 'secretword'
|
||||||
ordinary pages are OK, and expopages and expofiles are OK, even though they come through troggle. And the
|
The hash CHANGES whenever Django upgrades the encryption key length. Better to create the test uses
|
||||||
fixtures are certainly loaded into the db as the other tests show.
|
algorithmically and not via a fixture.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# The fixtures have a password hash which is compatible with plain-text password 'secretword'
|
|
||||||
# The hash CHANGES whenever Django upgrades the encryption key length. Better to create the test uses
|
|
||||||
# algorithmically and not via a fixture.
|
|
||||||
fixtures = ["expo_caves", "expo_exped"]
|
fixtures = ["expo_caves", "expo_exped"]
|
||||||
ph = r"and leads in 800m of tortuous going to"
|
ph = r"and leads in 800m of tortuous going to"
|
||||||
|
|
||||||
@ -118,6 +121,11 @@ class FixturePageTests(TestCase):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
for kataster_number in settings.NOTABLECAVES1623:
|
||||||
|
create_cave(areacode="1623", kataster_number=kataster_number)
|
||||||
|
for kataster_number in settings.NOTABLECAVES1626:
|
||||||
|
create_cave(areacode="1626", kataster_number=kataster_number)
|
||||||
|
|
||||||
create_user(name="expo")
|
create_user(name="expo")
|
||||||
create_user(name="expotest")
|
create_user(name="expotest")
|
||||||
create_user(name="expotestadmin", is_superuser = True)
|
create_user(name="expotestadmin", is_superuser = True)
|
||||||
@ -129,6 +137,7 @@ class FixturePageTests(TestCase):
|
|||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
User.objects.all().delete()
|
User.objects.all().delete()
|
||||||
|
Cave.objects.all().delete()
|
||||||
|
|
||||||
def test_fix_expedition(self):
|
def test_fix_expedition(self):
|
||||||
response = self.client.get("/expedition/2019")
|
response = self.client.get("/expedition/2019")
|
||||||
|
@ -178,19 +178,19 @@ def caveKey(c):
|
|||||||
|
|
||||||
def getnotablecaves():
|
def getnotablecaves():
|
||||||
notablecaves = []
|
notablecaves = []
|
||||||
for kataster_number in settings.NOTABLECAVESHREFS:
|
for kataster_number in settings.NOTABLECAVES1623:
|
||||||
try:
|
try:
|
||||||
cave = Cave.objects.get(kataster_number=kataster_number, areacode="1623")
|
cave = Cave.objects.get(kataster_number=kataster_number, areacode="1623")
|
||||||
notablecaves.append(cave)
|
notablecaves.append(cave)
|
||||||
except:
|
except:
|
||||||
print(" ! Notable Caves: FAILED to get only one cave per kataster_number OR invalid number for: "+kataster_number)
|
print(" ! Notable Caves: FAILED to get only one cave per kataster_number OR invalid number for: 1623-"+kataster_number)
|
||||||
|
|
||||||
try:
|
for kataster_number in settings.NOTABLECAVES1626:
|
||||||
hc = Cave.objects.get(kataster_number=359, areacode="1626")
|
try:
|
||||||
notablecaves.append(hc)
|
cave = Cave.objects.get(kataster_number=kataster_number, areacode="1626")
|
||||||
except:
|
notablecaves.append(cave)
|
||||||
# fails during the tests because this cave has not been loaded for tests, so catch it here.
|
except:
|
||||||
pass
|
print(" ! Notable Caves: FAILED to get only one cave per kataster_number OR invalid number for: 1626-"+kataster_number)
|
||||||
print(notablecaves)
|
print(notablecaves)
|
||||||
return notablecaves
|
return notablecaves
|
||||||
|
|
||||||
|
@ -37,6 +37,9 @@ CAVERN = "cavern" # for parsing .svx files and producing .3d files
|
|||||||
SURVEXPORT = "survexport" # for parsing .3d files and producing .pos files
|
SURVEXPORT = "survexport" # for parsing .3d files and producing .pos files
|
||||||
MOGRIFY = "mogrify" # for rotating images
|
MOGRIFY = "mogrify" # for rotating images
|
||||||
|
|
||||||
|
NOTABLECAVES1623 = ["290", "291", "264", "258", "204"]
|
||||||
|
NOTABLECAVES1626 = ["359"]
|
||||||
|
|
||||||
# Note that this builds upon the django system installed
|
# Note that this builds upon the django system installed
|
||||||
# global settings in
|
# global settings in
|
||||||
# django/conf/global_settings.py which is automatically loaded first.
|
# django/conf/global_settings.py which is automatically loaded first.
|
||||||
|
Loading…
Reference in New Issue
Block a user