File tree 2 files changed +28
-0
lines changed
2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ class Source(typing.NamedTuple):
46
46
project : str
47
47
package : str
48
48
rev : typing .Optional [str ] = None
49
+ repository : typing .Optional [str ] = None
49
50
50
51
def asxml (self ) -> ObjectifiedElement :
51
52
return E .source (** {field : getattr (self , field )
Original file line number Diff line number Diff line change @@ -476,6 +476,33 @@ def test_create(self):
476
476
b"</request>" ,
477
477
)
478
478
479
+ with self .subTest (
480
+ "XML content, source with optional repository"
481
+ ), mock .patch .object (
482
+ self .osc .session , "send" , return_value = mock_response
483
+ ) as mock_session :
484
+ self .osc .requests .create (
485
+ actions = [
486
+ Action (
487
+ type = ActionType .RELEASE ,
488
+ source = Source (
489
+ project = "Foo:Bar" , package = "p" , repository = "images"
490
+ ),
491
+ target = Target (project = "Baz:Qux" ),
492
+ )
493
+ ]
494
+ )
495
+ self .assertEqual (
496
+ mock_session .call_args [0 ][0 ].body ,
497
+ b"<?xml version='1.0' encoding='utf-8'?>\n "
498
+ b"<request>"
499
+ b'<action type="release">'
500
+ b'<target project="Baz:Qux"/>'
501
+ b'<source project="Foo:Bar" package="p" repository="images"/>'
502
+ b"</action>"
503
+ b"</request>" ,
504
+ )
505
+
479
506
with self .subTest (
480
507
"XML content, target with optional repository"
481
508
), mock .patch .object (
You can’t perform that action at this time.
0 commit comments