11def test_api_version (client , app ):
22 response = client .get ("/api/branches" )
3- branches = {}
4- for branch in app .config ["BRANCHES" ]:
5- if branch ["enabled" ]:
6- branches [branch ["name" ]] = branch
7- assert response .json == branches
3+ assert response .status == "302 FOUND"
84
95
106def test_api_build (client ):
@@ -19,15 +15,12 @@ def test_api_build(client):
1915 )
2016 assert response .status == "202 ACCEPTED"
2117 assert response .json .get ("status" ) == "queued"
22- assert response .json .get ("request_hash" ) == "3128aff5c6db "
18+ assert response .json .get ("request_hash" ) == "e360f833a191 "
2319
2420
2521def test_api_latest_default (client ):
2622 response = client .get ("/api/latest" )
27- assert "19.07.7" in response .json ["latest" ]
28- assert "21.02.0-rc1" in response .json ["latest" ]
29- assert "SNAPSHOT" in response .json ["latest" ]
30- assert response .status == "200 OK"
23+ assert response .status == "302 FOUND"
3124
3225
3326def test_api_build_mapping (client ):
@@ -42,11 +35,44 @@ def test_api_build_mapping(client):
4235 )
4336 assert response .status == "202 ACCEPTED"
4437 assert response .json .get ("status" ) == "queued"
45- assert response .json .get ("request_hash" ) == "d0318d0bba8d"
38+ assert response .json .get ("request_hash" ) == "19bb42f198c9"
39+
40+
41+ def test_api_build_mapping_abi (client ):
42+ response = client .post (
43+ "/api/build" ,
44+ json = dict (
45+ version = "SNAPSHOT" ,
46+ target = "testtarget/testsubtarget" ,
47+ profile = "testvendor,testprofile" ,
48+ packages = ["test1-1" , "test2" ],
49+ ),
50+ )
51+ assert response .status == "202 ACCEPTED"
52+ assert response .json .get ("status" ) == "queued"
53+ assert response .json .get ("request_hash" ) == "7d099fb07fb3"
54+
55+
56+ def test_api_build_bad_target (client ):
57+ response = client .post (
58+ "/api/build" ,
59+ json = dict (
60+ version = "SNAPSHOT" ,
61+ target = "testtarget/testsubtargetbad" ,
62+ profile = "testvendor,testprofile" ,
63+ packages = ["test1" , "test2" ],
64+ ),
65+ )
66+ assert response .status == "400 BAD REQUEST"
67+ assert (
68+ response .json .get ("message" )
69+ == "Unsupported target: testtarget/testsubtargetbad"
70+ )
71+ assert response .json .get ("status" ) == "bad_target"
4672
4773
4874def test_api_build_get (client ):
49- client .post (
75+ response = client .post (
5076 "/api/build" ,
5177 json = dict (
5278 version = "SNAPSHOT" ,
@@ -55,10 +81,42 @@ def test_api_build_get(client):
5581 packages = ["test1" , "test2" ],
5682 ),
5783 )
58- response = client .get ("/api/build/3128aff5c6db" )
84+ assert response .json ["request_hash" ] == "e360f833a191"
85+ response = client .get ("/api/build/e360f833a191" )
5986 assert response .status == "202 ACCEPTED"
6087 assert response .json .get ("status" ) == "queued"
61- assert response .json .get ("request_hash" ) == "3128aff5c6db"
88+ assert response .json .get ("request_hash" ) == "e360f833a191"
89+
90+
91+ def test_api_build_packages_versions (client ):
92+ response = client .post (
93+ "/api/build" ,
94+ json = dict (
95+ version = "SNAPSHOT" ,
96+ target = "testtarget/testsubtarget" ,
97+ profile = "testprofile" ,
98+ packages_versions = {"test1" : "1.0" , "test2" : "2.0" },
99+ ),
100+ )
101+ assert response .json ["request_hash" ] == "552b9e328888"
102+ response = client .get ("/api/build/552b9e328888" )
103+ assert response .status == "202 ACCEPTED"
104+ assert response .json .get ("status" ) == "queued"
105+ assert response .json .get ("request_hash" ) == "552b9e328888"
106+
107+
108+ def test_api_build_packages_duplicate (client ):
109+ response = client .post (
110+ "/api/build" ,
111+ json = dict (
112+ version = "SNAPSHOT" ,
113+ target = "testtarget/testsubtarget" ,
114+ profile = "testprofile" ,
115+ packages = ["test1" , "test2" ],
116+ packages_versions = {"test1" : "1.0" , "test2" : "2.0" },
117+ ),
118+ )
119+ assert response .status == "400 BAD REQUEST"
62120
63121
64122def test_api_build_get_not_found (client ):
@@ -83,7 +141,7 @@ def test_api_build_empty_packages_list(client):
83141 )
84142 assert response .status == "202 ACCEPTED"
85143 assert response .json .get ("status" ) == "queued"
86- assert response .json .get ("request_hash" ) == "c6022275d623 "
144+ assert response .json .get ("request_hash" ) == "66cb932c37a4 "
87145
88146
89147def test_api_build_withouth_packages_list (client ):
@@ -97,7 +155,7 @@ def test_api_build_withouth_packages_list(client):
97155 )
98156 assert response .status == "202 ACCEPTED"
99157 assert response .json .get ("status" ) == "queued"
100- assert response .json .get ("request_hash" ) == "c6022275d623 "
158+ assert response .json .get ("request_hash" ) == "66cb932c37a4 "
101159
102160
103161def test_api_build_prerelease_snapshot (client ):
@@ -162,7 +220,7 @@ def test_api_build_x86(client):
162220
163221 assert response .status == "202 ACCEPTED"
164222 assert response .json .get ("status" ) == "queued"
165- assert response .json .get ("request_hash" ) == "a30a7dc8e19b "
223+ assert response .json .get ("request_hash" ) == "1fda145d439f "
166224
167225
168226def test_api_build_needed (client ):
0 commit comments