Skip to content

Commit

Permalink
test: Confirm changes are returned for draft and rfc
Browse files Browse the repository at this point in the history
  • Loading branch information
jennifer-richards committed Aug 10, 2023
1 parent 4437796 commit 112ac90
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions ietf/sync/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,11 +347,10 @@ def test_rfc_index(self):
draft_abstract_before = draft_doc.abstract
draft_pages_before = draft_doc.pages
changes = []
for cs, d, rfc_published in rfceditor.update_docs_from_rfc_index(data, errata, today - datetime.timedelta(days=30)):
changes.append(cs)
for _, d, rfc_published in rfceditor.update_docs_from_rfc_index(data, errata, today - datetime.timedelta(days=30)):
changes.append({"doc_pk": d.pk, "rfc_published": rfc_published}) # we ignore the actual change list

draft_doc = Document.objects.get(name=draft_doc.name)

draft_events = draft_doc.docevent_set.all()
self.assertEqual(len(draft_events) - event_count_before, 2)
self.assertEqual(draft_events[0].type, "sync_from_rfc_editor")
Expand Down Expand Up @@ -385,6 +384,13 @@ def test_rfc_index(self):
self.assertEqual(rfc_doc.std_level_id, "ps")
self.assertEqual(rfc_doc.pages, 42)

# check that we got the expected changes
self.assertEqual(len(changes), 2)
self.assertEqual(changes[0]["doc_pk"], draft_doc.pk)
self.assertEqual(changes[0]["rfc_published"], False)
self.assertEqual(changes[1]["doc_pk"], rfc_doc.pk)
self.assertEqual(changes[1]["rfc_published"], True)

# make sure we can apply it again with no changes
changed = list(rfceditor.update_docs_from_rfc_index(data, errata, today - datetime.timedelta(days=30)))
self.assertEqual(len(changed), 0)
Expand Down

0 comments on commit 112ac90

Please sign in to comment.