1+ from pytest import MonkeyPatch
2+
13from linodecli .exit_codes import ExitCodes
24from tests .integration .helpers import (
35 BASE_CMDS ,
1517)
1618
1719
18- def test_help_image_sharegroups ():
20+ def test_help_image_sharegroups (monkeypatch : MonkeyPatch ):
21+ monkeypatch .setenv ("LINODE_CLI_API_VERSION" , "v4beta" )
1922 output = exec_test_command (
2023 BASE_CMDS ["image-sharegroups" ] + ["--help" , "--text" , "--delimiter=," ]
2124 )
@@ -45,7 +48,8 @@ def test_help_image_sharegroups():
4548 assert_help_actions_list (actions , output )
4649
4750
48- def test_list_all_share_groups ():
51+ def test_list_all_share_groups (monkeypatch : MonkeyPatch ):
52+ monkeypatch .setenv ("LINODE_CLI_API_VERSION" , "v4beta" )
4953 result = exec_test_command (
5054 BASE_CMDS ["image-sharegroups" ] + ["list" , "--delimiter" , "," , "--text" ]
5155 )
@@ -63,8 +67,9 @@ def test_list_all_share_groups():
6367
6468
6569def test_add_list_update_remove_image_to_share_group (
66- create_share_group , create_image_id
70+ create_share_group , create_image_id , monkeypatch : MonkeyPatch
6771):
72+ monkeypatch .setenv ("LINODE_CLI_API_VERSION" , "v4beta" )
6873 result_add_image = exec_test_command (
6974 BASE_CMDS ["image-sharegroups" ]
7075 + [
@@ -153,7 +158,8 @@ def test_add_list_update_remove_image_to_share_group(
153158 delete_target_id (target = "linodes" , id = create_image_id [0 ])
154159
155160
156- def test_try_add_member_use_invalid_token (create_share_group ):
161+ def test_try_add_member_use_invalid_token (create_share_group , monkeypatch : MonkeyPatch ):
162+ monkeypatch .setenv ("LINODE_CLI_API_VERSION" , "v4beta" )
157163 result = exec_failing_test_command (
158164 BASE_CMDS ["image-sharegroups" ]
159165 + [
@@ -175,7 +181,8 @@ def test_try_add_member_use_invalid_token(create_share_group):
175181 delete_target_id (target = "image-sharegroups" , id = create_share_group [0 ])
176182
177183
178- def test_list_members_for_invalid_token (create_share_group ):
184+ def test_list_members_for_invalid_token (create_share_group , monkeypatch : MonkeyPatch ):
185+ monkeypatch .setenv ("LINODE_CLI_API_VERSION" , "v4beta" )
179186 result = exec_test_command (
180187 BASE_CMDS ["image-sharegroups" ]
181188 + [
@@ -194,7 +201,8 @@ def test_list_members_for_invalid_token(create_share_group):
194201 delete_target_id (target = "image-sharegroups" , id = create_share_group [0 ])
195202
196203
197- def test_try_revoke_membership_for_invalid_token ():
204+ def test_try_revoke_membership_for_invalid_token (monkeypatch : MonkeyPatch ):
205+ monkeypatch .setenv ("LINODE_CLI_API_VERSION" , "v4beta" )
198206 result = exec_failing_test_command (
199207 BASE_CMDS ["image-sharegroups" ]
200208 + [
@@ -212,7 +220,8 @@ def test_try_revoke_membership_for_invalid_token():
212220 assert "Not found" in result
213221
214222
215- def test_try_update_membership_for_invalid_token ():
223+ def test_try_update_membership_for_invalid_token (monkeypatch : MonkeyPatch ):
224+ monkeypatch .setenv ("LINODE_CLI_API_VERSION" , "v4beta" )
216225 result = exec_failing_test_command (
217226 BASE_CMDS ["image-sharegroups" ]
218227 + [
@@ -232,7 +241,8 @@ def test_try_update_membership_for_invalid_token():
232241 assert "Not found" in result
233242
234243
235- def test_try_view_membership_for_invalid_token ():
244+ def test_try_view_membership_for_invalid_token (monkeypatch : MonkeyPatch ):
245+ monkeypatch .setenv ("LINODE_CLI_API_VERSION" , "v4beta" )
236246 result = exec_failing_test_command (
237247 BASE_CMDS ["image-sharegroups" ]
238248 + [
@@ -250,7 +260,8 @@ def test_try_view_membership_for_invalid_token():
250260 assert "Not found" in result
251261
252262
253- def test_create_read_update_delete_share_group ():
263+ def test_create_read_update_delete_share_group (monkeypatch : MonkeyPatch ):
264+ monkeypatch .setenv ("LINODE_CLI_API_VERSION" , "v4beta" )
254265 group_label = get_random_text (8 ) + "_sharegroup_cli_test"
255266 create_result = exec_test_command (
256267 BASE_CMDS ["image-sharegroups" ]
@@ -316,7 +327,8 @@ def test_create_read_update_delete_share_group():
316327 assert "Not found" in result_after_delete
317328
318329
319- def test_try_to_create_token (create_share_group ):
330+ def test_try_to_create_token (create_share_group , monkeypatch : MonkeyPatch ):
331+ monkeypatch .setenv ("LINODE_CLI_API_VERSION" , "v4beta" )
320332 share_group_uuid = create_share_group [1 ]
321333 result = exec_failing_test_command (
322334 BASE_CMDS ["image-sharegroups" ]
@@ -338,7 +350,8 @@ def test_try_to_create_token(create_share_group):
338350 delete_target_id (target = "image-sharegroups" , id = create_share_group [0 ])
339351
340352
341- def test_try_read_invalid_token ():
353+ def test_try_read_invalid_token (monkeypatch : MonkeyPatch ):
354+ monkeypatch .setenv ("LINODE_CLI_API_VERSION" , "v4beta" )
342355 result = exec_failing_test_command (
343356 BASE_CMDS ["image-sharegroups" ]
344357 + ["token-view" , "36b0-4d52_invalid" , "--delimiter" , "," , "--text" ],
@@ -348,7 +361,8 @@ def test_try_read_invalid_token():
348361 assert "Not found" in result
349362
350363
351- def test_try_to_update_invalid_token ():
364+ def test_try_to_update_invalid_token (monkeypatch : MonkeyPatch ):
365+ monkeypatch .setenv ("LINODE_CLI_API_VERSION" , "v4beta" )
352366 result = exec_failing_test_command (
353367 BASE_CMDS ["image-sharegroups" ]
354368 + [
@@ -366,7 +380,8 @@ def test_try_to_update_invalid_token():
366380 assert "Not found" in result
367381
368382
369- def test_try_to_delete_token ():
383+ def test_try_to_delete_token (monkeypatch : MonkeyPatch ):
384+ monkeypatch .setenv ("LINODE_CLI_API_VERSION" , "v4beta" )
370385 result = exec_failing_test_command (
371386 BASE_CMDS ["image-sharegroups" ]
372387 + ["token-delete" , "36b0-4d52_invalid" , "--delimiter" , "," , "--text" ],
@@ -376,7 +391,8 @@ def test_try_to_delete_token():
376391 assert "Not found" in result
377392
378393
379- def test_get_details_about_all_the_users_tokens ():
394+ def test_get_details_about_all_the_users_tokens (monkeypatch : MonkeyPatch ):
395+ monkeypatch .setenv ("LINODE_CLI_API_VERSION" , "v4beta" )
380396 result = exec_test_command (
381397 BASE_CMDS ["image-sharegroups" ]
382398 + ["tokens-list" , "--delimiter" , "," , "--text" ]
@@ -393,7 +409,8 @@ def test_get_details_about_all_the_users_tokens():
393409 assert_headers_in_lines (headers , lines )
394410
395411
396- def test_try_to_list_all_shared_images_for_invalid_token ():
412+ def test_try_to_list_all_shared_images_for_invalid_token (monkeypatch : MonkeyPatch ):
413+ monkeypatch .setenv ("LINODE_CLI_API_VERSION" , "v4beta" )
397414 result = exec_failing_test_command (
398415 BASE_CMDS ["image-sharegroups" ]
399416 + [
@@ -409,7 +426,8 @@ def test_try_to_list_all_shared_images_for_invalid_token():
409426 assert "Not found" in result
410427
411428
412- def test_try_gets_details_about_your_share_group_for_invalid_token ():
429+ def test_try_gets_details_about_your_share_group_for_invalid_token (monkeypatch : MonkeyPatch ):
430+ monkeypatch .setenv ("LINODE_CLI_API_VERSION" , "v4beta" )
413431 result = exec_failing_test_command (
414432 BASE_CMDS ["image-sharegroups" ]
415433 + [
0 commit comments