Skip to content

Commit 096c08a

Browse files
committed
Added a test case for draft submission errors due to periods in document names.
- Legacy-Id: 17251
1 parent 060539c commit 096c08a

1 file changed

Lines changed: 27 additions & 1 deletion

File tree

ietf/submit/tests.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright The IETF Trust 2011-2019, All Rights Reserved
1+
# Copyright The IETF Trust 2011-2020, All Rights Reserved
22
# -*- coding: utf-8 -*-
33

44

@@ -1035,13 +1035,39 @@ def submit_bad_file(self, name, formats):
10351035

10361036
return r, q, m
10371037

1038+
def submit_bad_doc_name_with_ext(self, name, formats):
1039+
group = None
1040+
url = urlreverse('ietf.submit.views.upload_submission')
1041+
1042+
# submit
1043+
files = {}
1044+
for format in formats:
1045+
rev = '00.%s' % format
1046+
files[format], author = submission_file(name, rev, group, format, "test_submission.%s" % format)
1047+
files[format].name = "%s-%s.%s" % (name, 00, format)
1048+
1049+
r = self.client.post(url, files)
1050+
1051+
self.assertEqual(r.status_code, 200)
1052+
q = PyQuery(r.content)
1053+
self.assertTrue(len(q("form .has-error")) > 0)
1054+
m = q('div.has-error div.alert').text()
1055+
1056+
return r, q, m
1057+
10381058
def test_submit_bad_file_txt(self):
10391059
r, q, m = self.submit_bad_file("some name", ["txt"])
10401060
self.assertIn('Invalid characters were found in the name', m)
10411061
self.assertIn('Expected the TXT file to have extension ".txt"', m)
10421062
self.assertIn('Expected an TXT file of type "text/plain"', m)
10431063
self.assertIn('document does not contain a legitimate name', m)
10441064

1065+
def test_submit_bad_doc_name_txt(self):
1066+
r, q, m = self.submit_bad_doc_name_with_ext("draft-foo.dot-bar", ["txt"])
1067+
self.assertIn('contains a disallowed character with byte code: 46', m)
1068+
r, q, m = self.submit_bad_doc_name_with_ext("draft-foo-bar", ["xml"])
1069+
self.assertIn('Did you include a filename extension in the name by mistake?', m)
1070+
10451071
def test_submit_bad_file_xml(self):
10461072
r, q, m = self.submit_bad_file("some name", ["xml"])
10471073
self.assertIn('Invalid characters were found in the name', m)

0 commit comments

Comments
 (0)