8000 chore: tweak test setup so blob storage is ok with overwrites by rjsparks · Pull Request #9025 · ietf-tools/datatracker · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

chore: tweak test setup so blob storage is ok with overwrites #9025

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 19, 2025
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-some 8000 body-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
0