mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-24 00:01:54 +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.contrib.auth.models import User
|
||||
|
||||
import settings
|
||||
|
||||
from troggle.core.models.caves import Cave
|
||||
from troggle.core.models.troggle import Person, PersonExpedition, Expedition
|
||||
from troggle.core.utils import current_expo
|
||||
@ -24,6 +26,11 @@ def create_user(name=None, last_name="Caver", is_superuser=False):
|
||||
u.save()
|
||||
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
|
||||
# FIXTURE_DIRS = settings.PYTHON_PATH / "core" /"fixtures"
|
||||
|
||||
@ -102,14 +109,10 @@ 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. 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'
|
||||
The hash CHANGES whenever Django upgrades the encryption key length. Better to create the test uses
|
||||
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"]
|
||||
ph = r"and leads in 800m of tortuous going to"
|
||||
|
||||
@ -118,6 +121,11 @@ class FixturePageTests(TestCase):
|
||||
pass
|
||||
|
||||
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="expotest")
|
||||
create_user(name="expotestadmin", is_superuser = True)
|
||||
@ -129,6 +137,7 @@ class FixturePageTests(TestCase):
|
||||
|
||||
def tearDown(self):
|
||||
User.objects.all().delete()
|
||||
Cave.objects.all().delete()
|
||||
|
||||
def test_fix_expedition(self):
|
||||
response = self.client.get("/expedition/2019")
|
||||
|
@ -178,19 +178,19 @@ def caveKey(c):
|
||||
|
||||
def getnotablecaves():
|
||||
notablecaves = []
|
||||
for kataster_number in settings.NOTABLECAVESHREFS:
|
||||
for kataster_number in settings.NOTABLECAVES1623:
|
||||
try:
|
||||
cave = Cave.objects.get(kataster_number=kataster_number, areacode="1623")
|
||||
notablecaves.append(cave)
|
||||
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:
|
||||
hc = Cave.objects.get(kataster_number=359, areacode="1626")
|
||||
notablecaves.append(hc)
|
||||
except:
|
||||
# fails during the tests because this cave has not been loaded for tests, so catch it here.
|
||||
pass
|
||||
for kataster_number in settings.NOTABLECAVES1626:
|
||||
try:
|
||||
cave = Cave.objects.get(kataster_number=kataster_number, areacode="1626")
|
||||
notablecaves.append(cave)
|
||||
except:
|
||||
print(" ! Notable Caves: FAILED to get only one cave per kataster_number OR invalid number for: 1626-"+kataster_number)
|
||||
print(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
|
||||
MOGRIFY = "mogrify" # for rotating images
|
||||
|
||||
NOTABLECAVES1623 = ["290", "291", "264", "258", "204"]
|
||||
NOTABLECAVES1626 = ["359"]
|
||||
|
||||
# Note that this builds upon the django system installed
|
||||
# global settings in
|
||||
# django/conf/global_settings.py which is automatically loaded first.
|
||||
|
Loading…
Reference in New Issue
Block a user