diff --git a/osbuild/monitor.py b/osbuild/monitor.py index 17bf02563..f0491914d 100644 --- a/osbuild/monitor.py +++ b/osbuild/monitor.py @@ -62,14 +62,15 @@ def with_origin(self, origin: Optional[str]) -> "Context": if origin is None or origin == self._origin: return self ctx = copy.copy(self) - ctx.set_origin(origin) + ctx.origin = origin return ctx @property def origin(self): return self._origin - def set_origin(self, origin: str): + @origin.setter + def origin(self, origin: str): self._origin = origin @property diff --git a/test/mod/test_monitor.py b/test/mod/test_monitor.py index 7bfd5b74e..a8244e4a8 100644 --- a/test/mod/test_monitor.py +++ b/test/mod/test_monitor.py @@ -143,7 +143,7 @@ def test_context(): assert ctx_dict["id"] == "75bf3feab3d5662744c3ac38406ba73142aeb67666b1180bc1006f913b18f792" assert len(ctx_dict) == 1 - ctx.set_origin("org.osbuild.test-2") + ctx.origin = "org.osbuild.test-2" ctx_dict = ctx.as_dict() # should be a full dict again assert "origin" in ctx_dict @@ -151,7 +151,7 @@ def test_context(): assert ctx_dict["pipeline"]["name"] == "test-pipeline" assert ctx_dict["pipeline"]["stage"]["name"] == "org.osbuild.noop" - ctx.set_origin("org.osbuild.test") + ctx.origin = "org.osbuild.test" ctx_dict = ctx.as_dict() # should only have id again (old context ID) assert ctx_dict["id"] == "75bf3feab3d5662744c3ac38406ba73142aeb67666b1180bc1006f913b18f792"