summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/TESTS/tests_logins.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/core/TESTS/tests_logins.py b/core/TESTS/tests_logins.py
index 1637a2c..0cbdad9 100644
--- a/core/TESTS/tests_logins.py
+++ b/core/TESTS/tests_logins.py
@@ -11,7 +11,6 @@ from http import HTTPStatus
from django.test import TestCase, SimpleTestCase, TransactionTestCase, Client
-
class DataTests(TestCase ):
'''These check that the NULL and NON-UNIQUE constraints are working in the database '''
@@ -64,7 +63,7 @@ class FixturePageTests(TestCase):
self.assertIsNone(t, 'Logged in as \'' + u.username + '\' (not staff) but still managed to get the Admin page' )
class PostTests(TestCase):
- '''
+ '''Tests scanupload form
'''
fixtures = ['auth_users']
@@ -88,14 +87,18 @@ class PostTests(TestCase):
logged_in = c.login(username=u.username, password='secretword')
with open('README.txt','r') as testf:
- response = self.client.post('/scanupload/2021:02', data={'title': '2021#00', 'name': 'README.txt', 'scanfiles': testf })
+ response = self.client.post('/scanupload/2021:00', data={'title': '2021#00', 'name': 'README.txt', 'scanfiles': testf })
content = response.content.decode()
self.assertEqual(response.status_code, 200)
self.assertEqual(response.status_code, HTTPStatus.OK)
- # with open('test_up.html', 'w') as f:
- # f.write(content)
- t = re.search(r'README.txt', content)
- self.assertIsNone(t, 'Logged in as \'' + u.username + '\' (not staff) but failed to upload file' )
+ with open('test_up.html', 'w') as f:
+ f.write(content)
+ t = re.search('<em>\'README', content)
+ self.assertIsNotNone(t, 'Logged in but failed to see "<em>\'README"' )
+ t = re.search(' saved as', content)
+ self.assertIsNotNone(t, 'Logged in but failed to see "File(s) saved as"' )
+ t = re.search('/expofiles/surveyscans/2021/2021%2300/README', content)
+ self.assertIsNotNone(t, 'Logged in but failed to see "/expofiles/..."' )