mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-16 14:27:03 +00:00
tests needed who_am_i field for cookie id
This commit is contained in:
@@ -3,6 +3,9 @@ Originally written for CUYC
|
|||||||
Philip Sargent (Feb.2021)
|
Philip Sargent (Feb.2021)
|
||||||
|
|
||||||
Modified for Expo April 2021.
|
Modified for Expo April 2021.
|
||||||
|
|
||||||
|
To run just these, do
|
||||||
|
uv run manage.py test -v 3 troggle.core.TESTS.test_logins
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import pathlib
|
import pathlib
|
||||||
@@ -146,11 +149,11 @@ class PostTests(TestCase):
|
|||||||
|
|
||||||
with open("core/fixtures/test_upload_file.txt", "r") as testf:
|
with open("core/fixtures/test_upload_file.txt", "r") as testf:
|
||||||
response = self.client.post(
|
response = self.client.post(
|
||||||
f"/walletedit/{testyear}:00", data={"name": "test_upload_file.txt", "uploadfiles": testf}
|
f"/walletedit/{testyear}:00", data={"name": "test_upload_file.txt", "uploadfiles": testf, "who_are_you": "Gumby <gumby@tent.expo>"}
|
||||||
)
|
)
|
||||||
content = response.content.decode()
|
content = response.content.decode()
|
||||||
self.assertEqual(response.status_code, HTTPStatus.OK)
|
self.assertEqual(response.status_code, HTTPStatus.OK)
|
||||||
# with open("_test_response.html", "w") as f:
|
# with open('_test_response__scan_upload.html', 'w') as f:
|
||||||
# f.write(content)
|
# f.write(content)
|
||||||
for ph in [
|
for ph in [
|
||||||
r"test_upload_",
|
r"test_upload_",
|
||||||
@@ -189,8 +192,8 @@ class PostTests(TestCase):
|
|||||||
content = response.content.decode()
|
content = response.content.decode()
|
||||||
self.assertEqual(response.status_code, HTTPStatus.OK)
|
self.assertEqual(response.status_code, HTTPStatus.OK)
|
||||||
self.assertEqual(response.status_code, HTTPStatus.OK)
|
self.assertEqual(response.status_code, HTTPStatus.OK)
|
||||||
with open('_test_response.html', 'w') as f:
|
# with open('_test_response_photo_upload.html', 'w') as f:
|
||||||
f.write(content)
|
# f.write(content)
|
||||||
for ph in [
|
for ph in [
|
||||||
r"test_upload_",
|
r"test_upload_",
|
||||||
r"Upload photos into /photos/" + str(current_year),
|
r"Upload photos into /photos/" + str(current_year),
|
||||||
@@ -281,13 +284,16 @@ class PostTests(TestCase):
|
|||||||
|
|
||||||
with open("core/fixtures/test_upload_file.pdf", "r") as testf:
|
with open("core/fixtures/test_upload_file.pdf", "r") as testf:
|
||||||
response = self.client.post(
|
response = self.client.post(
|
||||||
"/dwgupload/uploads", data={"name": "test_upload_file.txt", "uploadfiles": testf}
|
"/dwgupload/uploads", data={"name": "test_upload_file.txt", "uploadfiles": testf, "who_are_you": "Gumby <gumby@tent.expo>"}
|
||||||
)
|
)
|
||||||
content = response.content.decode()
|
content = response.content.decode()
|
||||||
|
# with open('_test_response_dwg_upload_txt.html', 'w') as f:
|
||||||
|
# f.write(content)
|
||||||
self.assertEqual(response.status_code, HTTPStatus.OK)
|
self.assertEqual(response.status_code, HTTPStatus.OK)
|
||||||
t = re.search("Files refused:", content)
|
t = re.search("Files refused:", content)
|
||||||
self.assertIsNotNone(t, 'Logged in but failed to see "Files refused:"')
|
self.assertIsNotNone(t, 'Logged in but failed to see "Files refused:"')
|
||||||
|
|
||||||
|
|
||||||
def test_dwg_upload_drawing(self):
|
def test_dwg_upload_drawing(self):
|
||||||
"""Expect no-suffix file to upload
|
"""Expect no-suffix file to upload
|
||||||
Note that this skips the git commit process. That would need a new test.
|
Note that this skips the git commit process. That would need a new test.
|
||||||
@@ -302,11 +308,11 @@ class PostTests(TestCase):
|
|||||||
|
|
||||||
with open("core/fixtures/test_upload_nosuffix", "r") as testf:
|
with open("core/fixtures/test_upload_nosuffix", "r") as testf:
|
||||||
response = self.client.post(
|
response = self.client.post(
|
||||||
"/dwguploadnogit/uploads", data={"name": "test_upload_nosuffix", "uploadfiles": testf}
|
"/dwguploadnogit/uploads", data={"name": "test_upload_nosuffix", "uploadfiles": testf, "who_are_you": "Gumby <gumby@tent.expo>"}
|
||||||
)
|
)
|
||||||
content = response.content.decode()
|
content = response.content.decode()
|
||||||
# with open('_test_response.html', 'w') as f:
|
# with open('_test_response_dwg_upload_drawing.html', 'w') as f:
|
||||||
# f.write(content)
|
# f.write(content)
|
||||||
self.assertEqual(response.status_code, HTTPStatus.OK)
|
self.assertEqual(response.status_code, HTTPStatus.OK)
|
||||||
for ph in [
|
for ph in [
|
||||||
r"test_upload_nosuffix",
|
r"test_upload_nosuffix",
|
||||||
|
|||||||
Reference in New Issue
Block a user