mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2026-03-30 06:29:49 +01:00
making test more robust
This commit is contained in:
@@ -10,6 +10,7 @@ uv run manage.py test -v 3 troggle.core.TESTS.test_logins
|
||||
|
||||
import pathlib
|
||||
import re
|
||||
import tempfile
|
||||
from http import HTTPStatus
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
@@ -240,8 +241,7 @@ class PostTests(TestCase):
|
||||
remove_file = pathlib.Path(settings.PHOTOS_ROOT, current_year) / rename
|
||||
if remove_file.is_file():
|
||||
remove_file.unlink()
|
||||
|
||||
|
||||
|
||||
|
||||
def test_photo_folder_create(self):
|
||||
"""Create folder for new user
|
||||
@@ -258,8 +258,8 @@ class PostTests(TestCase):
|
||||
response = self.client.post("/photoupload", data={"photographer": "GussieFinkNottle"})
|
||||
content = response.content.decode()
|
||||
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"Create new Photographer folder", r"/GussieFinkNottle/"]:
|
||||
phmatch = re.search(ph, content)
|
||||
self.assertIsNotNone(phmatch, "Failed to find expected text: '" + ph + "'")
|
||||
|
||||
Reference in New Issue
Block a user