Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Commit

Permalink
Merge pull request #282 from Kinto/261-fix-source-events
Browse files Browse the repository at this point in the history
Resource events on resign (ref #261)
  • Loading branch information
leplatrem committed Apr 16, 2021
2 parents dac0d39 + ab5aec0 commit e23685b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,25 @@ def test_resource_changed_is_triggered_for_source_collection(self):
self.assertEqual(event_signed.impacted_objects[0]["new"]["status"], "signed")
self.assertGreater(event_signed.payload["timestamp"], event_tosign.payload["timestamp"])

def test_resource_changed_is_triggered_for_resign(self):
self._sign()
before = len(listener.received)

self.app.patch_json(self.source_collection,
{"data": {"status": "to-resign"}},
headers=self.headers)

events = [e for e in listener.received[before:]
if e.payload["collection_id"] == "scid"]
assert len(events) == 2
event_tosign = events[0]
assert len(event_tosign.impacted_records) == 1
assert event_tosign.impacted_records[0]["new"]["status"] == "to-resign"
event_signed = events[1]
assert len(event_signed.impacted_records) == 1
assert event_signed.impacted_records[0]["old"]["status"] == "to-resign"
assert event_signed.impacted_records[0]["new"]["status"] == "signed"

def test_resource_changed_is_triggered_for_destination_collection(self):
before = len(listener.received)

Expand Down

0 comments on commit e23685b

Please sign in to comment.