test: test missing file

This commit is contained in:
Jennifer Richards 2024-07-20 13:02:32 -07:00
parent 0555eef13a
commit c7f6bdef0a
No known key found for this signature in database
GPG key ID: 9B2BF5C5ADDA6A6E

View file

@ -6246,6 +6246,12 @@ class MaterialsTests(TestCase):
q = PyQuery(r.content)
self.assertTrue(q('form input[type="checkbox"]'))
# test not submitting a file
r = self.client.post(url, dict(submission_method="upload"))
self.assertEqual(r.status_code, 200)
q = PyQuery(r.content)
self.assertTrue(q("form .is-invalid"))
test_file = BytesIO(b'this is some text for a test')
test_file.name = "not_really.json"
r = self.client.post(url,dict(submission_method="upload",file=test_file))