Skip to content

Commit 37118a6

Browse files
authored
fix: change api_submission blackout message to match web ui (ietf-tools#5623)
* test: api_submission returns an error in the blackout period * fix: change api_submission blackout message to match web ui (ietf-tools#5350)
1 parent 0ff693d commit 37118a6

2 files changed

Lines changed: 24 additions & 2 deletions

File tree

ietf/submit/forms.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def cleanup(): # called when context exited, even in case of exception
194194

195195
def clean(self):
196196
if self.shutdown and not has_role(self.request.user, "Secretariat"):
197-
raise forms.ValidationError('The submission tool is currently shut down')
197+
raise forms.ValidationError(self.cutoff_warning)
198198

199199
# check general submission rate thresholds before doing any more work
200200
today = date_today()
@@ -383,7 +383,7 @@ def format_messages(where, e, log):
383383
return msgs
384384

385385
if self.shutdown and not has_role(self.request.user, "Secretariat"):
386-
raise forms.ValidationError('The submission tool is currently shut down')
386+
raise forms.ValidationError(self.cutoff_warning)
387387

388388
for ext in self.formats:
389389
f = self.cleaned_data.get(ext, None)

ietf/submit/tests.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2744,6 +2744,10 @@ def supply_extra_metadata(self, name, status_url, submitter_name, submitter_emai
27442744
class ApiSubmissionTests(BaseSubmitTestCase):
27452745
TASK_TO_MOCK = "ietf.submit.views.process_and_accept_uploaded_submission_task"
27462746

2747+
def setUp(self):
2748+
super().setUp()
2749+
MeetingFactory(type_id='ietf', date=date_today()+datetime.timedelta(days=60))
2750+
27472751
def test_upload_draft(self):
27482752
"""api_submission accepts a submission and queues it for processing"""
27492753
url = urlreverse('ietf.submit.views.api_submission')
@@ -2890,6 +2894,24 @@ def test_submission_status(self):
28902894
r = self.client.get(urlreverse('ietf.submit.views.api_submission_status', kwargs={'submission_id': '999999'}))
28912895
self.assertEqual(r.status_code, 404)
28922896

2897+
def test_upload_blackout(self):
2898+
"""api_submission returns a useful error in the blackout period"""
2899+
# Put today in the blackout period
2900+
meeting = Meeting.get_current_meeting()
2901+
meeting.importantdate_set.create(name_id='idcutoff',date=date_today()-datetime.timedelta(days=2))
2902+
2903+
url = urlreverse('ietf.submit.views.api_submission')
2904+
xml, author = submission_file('draft-somebody-test-00', 'draft-somebody-test-00.xml', None, 'test_submission.xml')
2905+
data = {
2906+
'xml': xml,
2907+
'user': author.user.username,
2908+
}
2909+
2910+
with mock.patch('ietf.submit.views.process_uploaded_submission_task'):
2911+
r = self.client.post(url, data)
2912+
self.assertContains(r, 'The last submission time for the I-D submission was', status_code=400)
2913+
2914+
28932915

28942916
class SubmissionUploadFormTests(BaseSubmitTestCase):
28952917
def test_check_submission_thresholds(self):

0 commit comments

Comments
 (0)