Merge pull request #7714 from jennifer-richards/agenda-upload-error

fix: handle missing minutes / agenda file cleanly
This commit is contained in:
Robert Sparks 2024-07-20 16:31:07 -05:00 committed by GitHub
commit 7b82e60552
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

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))

View file

@ -2790,7 +2790,8 @@ class UploadOrEnterAgendaForm(UploadAgendaForm):
def clean_file(self):
submission_method = self.cleaned_data.get("submission_method")
if submission_method == "upload":
return super().clean_file()
if self.cleaned_data.get("file", None) is not None:
return super().clean_file()
return None
def clean(self):