diff --git a/CHANGELOG.md b/CHANGELOG.md index 7cde0c4e..7ee7a484 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Fixed a bug that export an empty maintenance report would crash. +- Fixed another bug that maintenance report could have an invalid `last_updated_by` value. ## [2.3.1] - 2019-10-03 diff --git a/pubtools/pulplib/_impl/model/maintenance.py b/pubtools/pulplib/_impl/model/maintenance.py index 8df8e5b0..89c6e29f 100644 --- a/pubtools/pulplib/_impl/model/maintenance.py +++ b/pubtools/pulplib/_impl/model/maintenance.py @@ -122,7 +122,7 @@ def _export_dict(self): """export a raw dictionary of maintenance report""" report = { "last_updated": write_timestamp(self.last_updated), - "last_updated_by": self.last_updated_by, + "last_updated_by": self.last_updated_by or self._OWNER, "repos": {}, } diff --git a/tests/maintenance/test_maintenance.py b/tests/maintenance/test_maintenance.py index 95f47ac4..cd8396df 100644 --- a/tests/maintenance/test_maintenance.py +++ b/tests/maintenance/test_maintenance.py @@ -103,3 +103,5 @@ def test_export_empty_report(): data = report._export_dict() # exported report should have a timestamp assert datetime.datetime.strptime(data["last_updated"], "%Y-%m-%dT%H:%M:%SZ") + # exported report should have the default owner + assert data["last_updated_by"] == "ContentDelivery"