Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions ietf/submit/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2981,7 +2981,7 @@ def test_process_and_accept_uploaded_submission_invalid(self):
xml_path = Path(settings.IDSUBMIT_STAGING_PATH) / 'draft-somebody-test-00.xml'
with xml_path.open('w') as f:
f.write(xml_data)
store_str("staging", "draft-somebody-test-00.xml", xml_data)
store_str("staging", "draft-somebody-test-00.xml", xml_data, allow_overwrite=True)
with mock.patch(
'ietf.submit.utils.apply_checkers',
side_effect = lambda _, __: submission.checks.create(
Expand Down Expand Up @@ -3047,25 +3047,25 @@ def test_process_submission_xml(self):
# Should behave on missing or partial <date> elements
TestBlobstoreManager().emptyTestBlobstores()
xml_path.write_text(re.sub(r"<date.+>", "", xml_contents)) # strip <date...> entirely
store_str("staging", "draft-somebody-test-00.xml", re.sub(r"<date.+>", "", xml_contents))
store_str("staging", "draft-somebody-test-00.xml", re.sub(r"<date.+>", "", xml_contents), allow_overwrite=True)
output = process_submission_xml("draft-somebody-test", "00")
self.assertEqual(output["document_date"], None)

TestBlobstoreManager().emptyTestBlobstores()
xml_path.write_text(re.sub(r"<date year=.+ month", "<date month", xml_contents)) # remove year
store_str("staging", "draft-somebody-test-00.xml", re.sub(r"<date year=.+ month", "<date month", xml_contents))
store_str("staging", "draft-somebody-test-00.xml", re.sub(r"<date year=.+ month", "<date month", xml_contents), allow_overwrite=True)
output = process_submission_xml("draft-somebody-test", "00")
self.assertEqual(output["document_date"], date_today())

TestBlobstoreManager().emptyTestBlobstores()
xml_path.write_text(re.sub(r"(<date.+) month=.+day=(.+>)", r"\1 day=\2", xml_contents)) # remove month
store_str("staging", "draft-somebody-test-00.xml", re.sub(r"(<date.+) month=.+day=(.+>)", r"\1 day=\2", xml_contents))
store_str("staging", "draft-somebody-test-00.xml", re.sub(r"(<date.+) month=.+day=(.+>)", r"\1 day=\2", xml_contents), allow_overwrite=True)
output = process_submission_xml("draft-somebody-test", "00")
self.assertEqual(output["document_date"], date_today())

TestBlobstoreManager().emptyTestBlobstores()
xml_path.write_text(re.sub(r"<date(.+) day=.+>", r"<date\1>", xml_contents)) # remove day
store_str("staging", "draft-somebody-test-00.xml", re.sub(r"<date(.+) day=.+>", r"<date\1>", xml_contents))
store_str("staging", "draft-somebody-test-00.xml", re.sub(r"<date(.+) day=.+>", r"<date\1>", xml_contents), allow_overwrite=True)
output = process_submission_xml("draft-somebody-test", "00")
self.assertEqual(output["document_date"], date_today())

Expand All @@ -3080,7 +3080,7 @@ def test_process_submission_xml(self):
)
xml_path.write_text(xml.read())
xml.seek(0)
store_str("staging", "draft-somebody-test-00.xml", xml.read())
store_str("staging", "draft-somebody-test-00.xml", xml.read(), allow_overwrite=True)
with self.assertRaisesMessage(SubmissionError, "disagrees with submission filename"):
process_submission_xml("draft-somebody-test", "00")

Expand All @@ -3095,7 +3095,7 @@ def test_process_submission_xml(self):
)
xml_path.write_text(xml.read())
xml.seek(0)
store_str("staging", "draft-somebody-test-00.xml", xml.read())
store_str("staging", "draft-somebody-test-00.xml", xml.read(), allow_overwrite=True)
with self.assertRaisesMessage(SubmissionError, "disagrees with submission revision"):
process_submission_xml("draft-somebody-test", "00")

Expand All @@ -3110,7 +3110,7 @@ def test_process_submission_xml(self):
)
xml_path.write_text(xml.read())
xml.seek(0)
store_str("staging", "draft-somebody-test-00.xml", xml.read())
store_str("staging", "draft-somebody-test-00.xml", xml.read(), allow_overwrite=True)
with self.assertRaisesMessage(SubmissionError, "Could not extract a valid title"):
process_submission_xml("draft-somebody-test", "00")

Expand Down Expand Up @@ -3153,7 +3153,7 @@ def test_process_submission_text(self):
with txt_path.open('w') as fd:
fd.write(txt.read())
txt.seek(0)
store_str("staging", "draft-somebody-test-00.txt", txt.read())
store_str("staging", "draft-somebody-test-00.txt", txt.read(), allow_overwrite=True)
txt.close()
with self.assertRaisesMessage(SubmissionError, 'disagrees with submission filename'):
process_submission_text("draft-somebody-test", "00")
Expand All @@ -3170,7 +3170,7 @@ def test_process_submission_text(self):
with txt_path.open('w') as fd:
fd.write(txt.read())
txt.seek(0)
store_str("staging", "draft-somebody-test-00.txt", txt.read())
store_str("staging", "draft-somebody-test-00.txt", txt.read(), allow_overwrite=True)
txt.close()
with self.assertRaisesMessage(SubmissionError, 'disagrees with submission revision'):
process_submission_text("draft-somebody-test", "00")
Expand Down
Loading