diff --git a/kinto-remote-settings/src/kinto_remote_settings/signer/updater.py b/kinto-remote-settings/src/kinto_remote_settings/signer/updater.py index 18ac6a63..9547cb6b 100644 --- a/kinto-remote-settings/src/kinto_remote_settings/signer/updater.py +++ b/kinto-remote-settings/src/kinto_remote_settings/signer/updater.py @@ -310,14 +310,14 @@ def get_source_records(self, **kwargs): def get_destination_records(self, **kwargs): return self._get_records(self.destination, **kwargs) - def push_records_to_destination(self, request): + def push_records_to_destination(self, request) -> int: dest_records, _dest_timestamp = self.get_destination_records() source_records, _source_timestamp = self.get_source_records() new_records = records_diff(source_records, dest_records) changes_count = len(new_records) if len(new_records) == 0: - return None + return 0 # Update the destination collection. for record in new_records: diff --git a/kinto-remote-settings/tests/signer/test_events.py b/kinto-remote-settings/tests/signer/test_events.py index 641006ac..1bd63fa1 100644 --- a/kinto-remote-settings/tests/signer/test_events.py +++ b/kinto-remote-settings/tests/signer/test_events.py @@ -498,6 +498,21 @@ def test_review_approved_is_triggered(self): assert isinstance(self.events[-1], signer_events.ReviewApproved) assert self.events[-1].changes_count == 2 + def test_changes_count_is_zero_when_no_changes(self): + self.app.delete( + self.source_collection + "/records", + headers=self.headers, + ) + + self.app.patch_json( + self.source_collection, + {"data": {"status": "to-sign"}}, + headers=self.headers, + ) + + assert isinstance(self.events[-1], signer_events.ReviewApproved) + assert self.events[-1].changes_count == 0 + def test_review_approved_is_not_triggered_on_resign(self): self.app.patch_json( self.source_collection,