diff --git a/osctiny/models/request.py b/osctiny/models/request.py index 876694b..0a72d26 100644 --- a/osctiny/models/request.py +++ b/osctiny/models/request.py @@ -46,6 +46,7 @@ class Source(typing.NamedTuple): project: str package: str rev: typing.Optional[str] = None + repository: typing.Optional[str] = None def asxml(self) -> ObjectifiedElement: return E.source(**{field: getattr(self, field) diff --git a/osctiny/tests/test_requests.py b/osctiny/tests/test_requests.py index 4bab27b..c157f4b 100644 --- a/osctiny/tests/test_requests.py +++ b/osctiny/tests/test_requests.py @@ -476,6 +476,33 @@ def test_create(self): b"", ) + with self.subTest( + "XML content, source with optional repository" + ), mock.patch.object( + self.osc.session, "send", return_value=mock_response + ) as mock_session: + self.osc.requests.create( + actions=[ + Action( + type=ActionType.RELEASE, + source=Source( + project="Foo:Bar", package="p", repository="images" + ), + target=Target(project="Baz:Qux"), + ) + ] + ) + self.assertEqual( + mock_session.call_args[0][0].body, + b"\n" + b"" + b'' + b'' + b'' + b"" + b"", + ) + with self.subTest( "XML content, target with optional repository" ), mock.patch.object(