2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-21 23:01:52 +00:00

update test to match new wallet json location

This commit is contained in:
Philip Sargent 2022-08-25 14:38:14 +03:00
parent 57c4732566
commit 8f03e590cc
2 changed files with 16 additions and 5 deletions

View File

@ -11,6 +11,7 @@ import pathlib
from http import HTTPStatus
from django.test import TestCase, SimpleTestCase, TransactionTestCase, Client
from troggle.core.models.survex import Wallet
import troggle.settings as settings
@ -43,7 +44,7 @@ class FixturePageTests(TestCase):
def setUp(self):
from django.contrib.auth.models import User
self.user = User.objects.get(username='expotest')
def tearDown(self):
pass
@ -77,15 +78,25 @@ class PostTests(TestCase):
from django.contrib.auth.models import User
self.user = User.objects.get(username='expotest')
self.client = Client()
wname = "2020#00"
w = Wallet()
w.pk = 9100
w.fpath = str(pathlib.Path(settings.SCANS_ROOT, wname))
w.walletname = wname
w.save()
self.wallet = w
def test_scan_upload(self):
'''Expect scan upload to wallet to work on any file
Need to login first.
This upload form looks for the cave, so the test fails if the database is not loaded with the cave
This upload form looks for the Cave and the Wallet, so the test fails if the database is not loaded with the cave
identified in the wallet
'''
c = self.client
w = self.wallet
from django.contrib.auth.models import User
u = User.objects.get(username='expotest')
@ -97,8 +108,8 @@ class PostTests(TestCase):
content = response.content.decode()
self.assertEqual(response.status_code, 200)
self.assertEqual(response.status_code, HTTPStatus.OK)
# with open('_test_response.html', 'w') as f:
# f.write(content)
with open('_test_response.html', 'w') as f:
f.write(content)
for ph in [ r'test_upload_',
r'← 2020#00 →',
r'description written',

View File

@ -14,5 +14,5 @@
"last_name": "Sargent",
"fullname": "Michael Sargent", "is_vfho": false, "mug_shot": null,
"blurb": "\n\n\n\n\n\n<p><img class=\"onleft\" src=\"/folk/i/mikey0.jpg\">\n<img class=\"onright\" src=\"/folk/i/mikey1.jpg\" height=\"400\"\nalt=\"\" />\n<b>Michael Sargent</b> CUCC<br />\nExpeditions 2014, 15, 16, 17, 18, 19.\n<p>The first second-generation expo caver in 2014, later members of this exclusive group were Dan Lenartowicz and Sarah Connolly.\n\n\n<img class=\"onleft\" src=\"/folk/i/michaelsargent.jpg\">\n<im\n\n<hr style=\"clear: both\" /><p class=\"caption\">Pre-expo (pre-student) photos from President's Invite (OUCC) \nand first abseiling instruction (Cambridge).</p>\n", "orderref": "",
"user": null}}
"user": null}}
]