@@ -226,6 +226,42 @@ def test_client_creation(
226
226
assert client .session .headers ["Authorization" ] == "Token {0}" .format (api_key )
227
227
228
228
229
+ @pytest .mark .parametrize (
230
+ ("base_uries" , "version" , "endpoints_and_urls" ),
231
+ [
232
+ (
233
+ ("https://api.gitguardian.com" ,),
234
+ "v1" ,
235
+ (
236
+ ("multiscan" , "https://api.gitguardian.com/v1/multiscan" ),
237
+ ("scan" , "https://api.gitguardian.com/v1/scan" ),
238
+ ),
239
+ ),
240
+ (
241
+ (
242
+ "https://gg-onprem-instance.company.com/exposed" ,
243
+ "https://gg-onprem-instance.company.com/exposed/" ,
244
+ ),
245
+ "v1" ,
246
+ (
247
+ (
248
+ "multiscan" ,
249
+ "https://gg-onprem-instance.company.com/exposed/v1/multiscan" ,
250
+ ),
251
+ ("scan" , "https://gg-onprem-instance.company.com/exposed/v1/scan" ),
252
+ ),
253
+ ),
254
+ ],
255
+ )
256
+ def test_client__url_from_endpoint (base_uries , version , endpoints_and_urls ):
257
+ for curr_base_uri in base_uries :
258
+ client = GGClient (api_key = "validapi_keyforsure" , base_uri = curr_base_uri )
259
+ for endpoint , expected_url in endpoints_and_urls :
260
+ assert (
261
+ client ._url_from_endpoint (endpoint , version ) == expected_url
262
+ ), "Could not get the expected URL for base_uri=`{}`" .format (base_uri )
263
+
264
+
229
265
@my_vcr .use_cassette
230
266
def test_health_check (client : GGClient ):
231
267
health = client .health_check ()
0 commit comments