fixed test broken by recent update

This commit is contained in:
Philip Sargent 2022-04-20 21:22:38 +03:00
parent c9931fd45e
commit 00eb978f5f
2 changed files with 6 additions and 5 deletions

1
.gitignore vendored
View File

@ -125,3 +125,4 @@ media/jslib/openlayers/Lang/te.js
media/jslib/openlayers/Lang/vi.js media/jslib/openlayers/Lang/vi.js
media/jslib/openlayers/Lang/zh-CN.js media/jslib/openlayers/Lang/zh-CN.js
media/jslib/openlayers/Lang/zh-TW.js media/jslib/openlayers/Lang/zh-TW.js
_test_response.html

View File

@ -202,14 +202,14 @@ 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('/dwguploadnogit/uploads', data={'name': 'test_upload_nosuffix', 'uploadfiles': testf }) response = self.client.post('/dwguploadnogit/uploads', data={'name': 'test_upload_nosuffix', 'uploadfiles': testf })
content = response.content.decode() content = response.content.decode()
# with open('_test_response.html', 'w') as f: with open('_test_response.html', 'w') as f:
# f.write(content) f.write(content)
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
for ph in [ r'Upload more', for ph in [ r'test_upload_nosuffix',
r' saved as ', r'You cannot create folders here',
r'Clicking on a filename only']: r'Clicking on a filename only']:
phmatch = re.search(ph, content) phmatch = re.search(ph, content)
self.assertIsNotNone(phmatch, "Failed to find expected text: '" + ph +"'") self.assertIsNotNone(phmatch, "Expect no-suffix file to upload OK. Failed to find expected text: '" + ph +"'")
# Does not use the filename Django actually uses, assumes it is unchanged. Potential bug. # Does not use the filename Django actually uses, assumes it is unchanged. Potential bug.
remove_file = pathlib.Path(settings.DRAWINGS_DATA) / 'uploads' / 'test_upload_nosuffix' remove_file = pathlib.Path(settings.DRAWINGS_DATA) / 'uploads' / 'test_upload_nosuffix'