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
14 changes: 9 additions & 5 deletions ietf/ipr/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -943,12 +943,14 @@ class DraftFormTests(TestCase):
def setUp(self):
super().setUp()
self.disclosure = IprDisclosureBaseFactory()
self.draft = WgDraftFactory()
self.draft = WgDraftFactory.create_batch(10)[-1]
self.rfc = RfcFactory()

def test_revisions_valid(self):
post_data = {
"document": str(self.draft.pk),
# n.b., "document" is a SearchableDocumentField, which is a multiple choice field limited
# to a single choice. Its value must be an array of pks with one element.
"document": [str(self.draft.pk)],
"disclosure": str(self.disclosure.pk),
}
# The revisions field is just a char field that allows descriptions of the applicable
Expand All @@ -960,7 +962,7 @@ def test_revisions_valid(self):
self.assertTrue(DraftForm(post_data | {"revisions": "01,03, 05"}).is_valid())
self.assertTrue(DraftForm(post_data | {"revisions": "all but 01"}).is_valid())
# RFC instead of draft - allow empty / missing revisions
post_data["document"] = str(self.rfc.pk)
post_data["document"] = [str(self.rfc.pk)]
self.assertTrue(DraftForm(post_data).is_valid())
self.assertTrue(DraftForm(post_data | {"revisions": ""}).is_valid())

Expand All @@ -971,7 +973,9 @@ def test_revisions_invalid(self):
null_char_error_msg = "Null characters are not allowed."

post_data = {
"document": str(self.draft.pk),
# n.b., "document" is a SearchableDocumentField, which is a multiple choice field limited
# to a single choice. Its value must be an array of pks with one element.
"document": [str(self.draft.pk)],
"disclosure": str(self.disclosure.pk),
}
self.assertFormError(
Expand All @@ -987,7 +991,7 @@ def test_revisions_invalid(self):
)
# RFC instead of draft still validates the revisions field
self.assertFormError(
DraftForm(post_data | {"document": str(self.rfc.pk), "revisions": "1\x00"}),
DraftForm(post_data | {"document": [str(self.rfc.pk)], "revisions": "1\x00"}),
"revisions",
null_char_error_msg,
)