mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-25 16:51:54 +00:00
login decorator moved into views & .gitignore
This commit is contained in:
parent
c8cc1673e0
commit
d841faa057
16
.gitignore
vendored
16
.gitignore
vendored
@ -15,22 +15,17 @@ _1623.pos
|
||||
_1623.svx
|
||||
_16230.svx
|
||||
cave-lookup.json
|
||||
core/migrations/0001_initial.py
|
||||
credentials.py
|
||||
core/migrations/*
|
||||
db*
|
||||
desktop.ini
|
||||
diffsettings.txt
|
||||
flatpages/migrations/0001_initial.py
|
||||
ignored-files.log
|
||||
import_profile.json
|
||||
lines-of-python.txt
|
||||
lines-of-templates.txt
|
||||
loadlogbk.log
|
||||
loadsurvexblks.log
|
||||
localsettings.py
|
||||
localsettings-expo-live.py
|
||||
logbktrips.shelve
|
||||
media/images/*
|
||||
memdump.sql
|
||||
my_project.dot
|
||||
parsing_log.txt
|
||||
@ -45,4 +40,13 @@ troggle.sqlite-journal
|
||||
troggle_log.txt
|
||||
tunnel-import.log
|
||||
logbktrips.shelve.db
|
||||
|
||||
credentials.py
|
||||
localsettings.py
|
||||
localsettings-expo-live.py
|
||||
_deploy/old/localsettings-expo-live.py
|
||||
_deploy/old/localsettings.py
|
||||
debian/localsettings.py
|
||||
debian/credentials.py
|
||||
wsl/localsettings.py
|
||||
wsl/credentials.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
|
||||
|
@ -9,6 +9,12 @@ from troggle.core.models import Person, PersonExpedition, Expedition, DataIssue
|
||||
from troggle.core.models_caves import Cave, Area, Entrance, CaveAndEntrance, LogbookEntry, PersonTrip, QM
|
||||
from troggle.core.models_survex import SurvexBlock, SurvexPersonRole, SurvexStation, ScansFolder, SingleScan
|
||||
|
||||
'''This code significantly adds to the capabilities of the Django Management control panel for Troggle data.
|
||||
In particular, it enables JSON export of any data with 'export_as_json'
|
||||
and configures the search fields to be used within the control panel.
|
||||
|
||||
What is the search path for the css and js inclusions in the Media subclasses though ?!
|
||||
'''
|
||||
|
||||
class TroggleModelAdmin(admin.ModelAdmin):
|
||||
|
||||
|
@ -19,7 +19,7 @@ from troggle.core.views import expo
|
||||
from troggle.core.models import Expedition, DataIssue
|
||||
from troggle.core.models_caves import CaveSlug, Cave, CaveAndEntrance, QM, EntranceSlug, Entrance, Area, SurvexStation, GetCaveLookup
|
||||
from troggle.core.forms import CaveForm, CaveAndEntranceFormSet, VersionControlCommentForm, EntranceForm, EntranceLetterForm
|
||||
from troggle.helper import login_required_if_public
|
||||
from .login import login_required_if_public
|
||||
|
||||
class MapLocations(object):
|
||||
p = [
|
||||
|
@ -13,7 +13,7 @@ from django.contrib import admin
|
||||
|
||||
import django.forms as forms
|
||||
|
||||
from troggle.helper import login_required_if_public
|
||||
from .login import login_required_if_public
|
||||
from troggle.core.models_caves import Cave
|
||||
import troggle.core.views.caves
|
||||
import troggle.settings as settings
|
||||
|
@ -18,7 +18,7 @@ from troggle.core.forms import getTripForm # , get_name, PersonForm
|
||||
from troggle.core.models import Expedition, Person, PersonExpedition
|
||||
from troggle.core.models_caves import LogbookEntry, PersonTrip
|
||||
from troggle.core.models_survex import SurvexBlock
|
||||
from troggle.helper import login_required_if_public
|
||||
from .login import login_required_if_public
|
||||
from troggle.parsers.logbooks import LoadLogbookForExpedition
|
||||
from troggle.parsers.people import GetPersonExpeditionNameLookup
|
||||
|
||||
|
@ -11,7 +11,7 @@ from django.template import Context, loader
|
||||
import troggle.parsers.imports
|
||||
from troggle.core.models import Expedition, Person, PersonExpedition
|
||||
from troggle.core.models_caves import LogbookEntry, QM, Cave, PersonTrip
|
||||
from troggle.helper import login_required_if_public
|
||||
from .login import login_required_if_public
|
||||
from troggle.core.forms import UploadFileForm
|
||||
|
||||
print("** importing troggle/core/views.other.py")
|
||||
|
Loading…
Reference in New Issue
Block a user