Skip to content

Commit c573961

Browse files
Point to v4beta for image sharing tests (#834)
1 parent 1517717 commit c573961

File tree

2 files changed

+45
-17
lines changed

2 files changed

+45
-17
lines changed

tests/integration/sharegroups/fixtures.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import pytest
2+
from pytest import MonkeyPatch
23

34
from tests.integration.helpers import (
45
BASE_CMDS,
@@ -120,7 +121,8 @@ def create_image_id(get_region):
120121

121122

122123
@pytest.fixture(scope="function")
123-
def create_share_group():
124+
def create_share_group(monkeypatch: MonkeyPatch):
125+
monkeypatch.setenv("LINODE_CLI_API_VERSION", "v4beta")
124126
label = get_random_text(8) + "_sharegroup_cli_test"
125127
share_group = exec_test_command(
126128
BASE_CMDS["image-sharegroups"]

tests/integration/sharegroups/test_images_sharegroups.py

Lines changed: 42 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from pytest import MonkeyPatch
2+
13
from linodecli.exit_codes import ExitCodes
24
from tests.integration.helpers import (
35
BASE_CMDS,
@@ -15,7 +17,8 @@
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

6569
def 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,10 @@ 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(
162+
create_share_group, monkeypatch: MonkeyPatch
163+
):
164+
monkeypatch.setenv("LINODE_CLI_API_VERSION", "v4beta")
157165
result = exec_failing_test_command(
158166
BASE_CMDS["image-sharegroups"]
159167
+ [
@@ -175,7 +183,10 @@ def test_try_add_member_use_invalid_token(create_share_group):
175183
delete_target_id(target="image-sharegroups", id=create_share_group[0])
176184

177185

178-
def test_list_members_for_invalid_token(create_share_group):
186+
def test_list_members_for_invalid_token(
187+
create_share_group, monkeypatch: MonkeyPatch
188+
):
189+
monkeypatch.setenv("LINODE_CLI_API_VERSION", "v4beta")
179190
result = exec_test_command(
180191
BASE_CMDS["image-sharegroups"]
181192
+ [
@@ -194,7 +205,8 @@ def test_list_members_for_invalid_token(create_share_group):
194205
delete_target_id(target="image-sharegroups", id=create_share_group[0])
195206

196207

197-
def test_try_revoke_membership_for_invalid_token():
208+
def test_try_revoke_membership_for_invalid_token(monkeypatch: MonkeyPatch):
209+
monkeypatch.setenv("LINODE_CLI_API_VERSION", "v4beta")
198210
result = exec_failing_test_command(
199211
BASE_CMDS["image-sharegroups"]
200212
+ [
@@ -212,7 +224,8 @@ def test_try_revoke_membership_for_invalid_token():
212224
assert "Not found" in result
213225

214226

215-
def test_try_update_membership_for_invalid_token():
227+
def test_try_update_membership_for_invalid_token(monkeypatch: MonkeyPatch):
228+
monkeypatch.setenv("LINODE_CLI_API_VERSION", "v4beta")
216229
result = exec_failing_test_command(
217230
BASE_CMDS["image-sharegroups"]
218231
+ [
@@ -232,7 +245,8 @@ def test_try_update_membership_for_invalid_token():
232245
assert "Not found" in result
233246

234247

235-
def test_try_view_membership_for_invalid_token():
248+
def test_try_view_membership_for_invalid_token(monkeypatch: MonkeyPatch):
249+
monkeypatch.setenv("LINODE_CLI_API_VERSION", "v4beta")
236250
result = exec_failing_test_command(
237251
BASE_CMDS["image-sharegroups"]
238252
+ [
@@ -250,7 +264,8 @@ def test_try_view_membership_for_invalid_token():
250264
assert "Not found" in result
251265

252266

253-
def test_create_read_update_delete_share_group():
267+
def test_create_read_update_delete_share_group(monkeypatch: MonkeyPatch):
268+
monkeypatch.setenv("LINODE_CLI_API_VERSION", "v4beta")
254269
group_label = get_random_text(8) + "_sharegroup_cli_test"
255270
create_result = exec_test_command(
256271
BASE_CMDS["image-sharegroups"]
@@ -316,7 +331,8 @@ def test_create_read_update_delete_share_group():
316331
assert "Not found" in result_after_delete
317332

318333

319-
def test_try_to_create_token(create_share_group):
334+
def test_try_to_create_token(create_share_group, monkeypatch: MonkeyPatch):
335+
monkeypatch.setenv("LINODE_CLI_API_VERSION", "v4beta")
320336
share_group_uuid = create_share_group[1]
321337
result = exec_failing_test_command(
322338
BASE_CMDS["image-sharegroups"]
@@ -338,7 +354,8 @@ def test_try_to_create_token(create_share_group):
338354
delete_target_id(target="image-sharegroups", id=create_share_group[0])
339355

340356

341-
def test_try_read_invalid_token():
357+
def test_try_read_invalid_token(monkeypatch: MonkeyPatch):
358+
monkeypatch.setenv("LINODE_CLI_API_VERSION", "v4beta")
342359
result = exec_failing_test_command(
343360
BASE_CMDS["image-sharegroups"]
344361
+ ["token-view", "36b0-4d52_invalid", "--delimiter", ",", "--text"],
@@ -348,7 +365,8 @@ def test_try_read_invalid_token():
348365
assert "Not found" in result
349366

350367

351-
def test_try_to_update_invalid_token():
368+
def test_try_to_update_invalid_token(monkeypatch: MonkeyPatch):
369+
monkeypatch.setenv("LINODE_CLI_API_VERSION", "v4beta")
352370
result = exec_failing_test_command(
353371
BASE_CMDS["image-sharegroups"]
354372
+ [
@@ -366,7 +384,8 @@ def test_try_to_update_invalid_token():
366384
assert "Not found" in result
367385

368386

369-
def test_try_to_delete_token():
387+
def test_try_to_delete_token(monkeypatch: MonkeyPatch):
388+
monkeypatch.setenv("LINODE_CLI_API_VERSION", "v4beta")
370389
result = exec_failing_test_command(
371390
BASE_CMDS["image-sharegroups"]
372391
+ ["token-delete", "36b0-4d52_invalid", "--delimiter", ",", "--text"],
@@ -376,7 +395,8 @@ def test_try_to_delete_token():
376395
assert "Not found" in result
377396

378397

379-
def test_get_details_about_all_the_users_tokens():
398+
def test_get_details_about_all_the_users_tokens(monkeypatch: MonkeyPatch):
399+
monkeypatch.setenv("LINODE_CLI_API_VERSION", "v4beta")
380400
result = exec_test_command(
381401
BASE_CMDS["image-sharegroups"]
382402
+ ["tokens-list", "--delimiter", ",", "--text"]
@@ -393,7 +413,10 @@ def test_get_details_about_all_the_users_tokens():
393413
assert_headers_in_lines(headers, lines)
394414

395415

396-
def test_try_to_list_all_shared_images_for_invalid_token():
416+
def test_try_to_list_all_shared_images_for_invalid_token(
417+
monkeypatch: MonkeyPatch,
418+
):
419+
monkeypatch.setenv("LINODE_CLI_API_VERSION", "v4beta")
397420
result = exec_failing_test_command(
398421
BASE_CMDS["image-sharegroups"]
399422
+ [
@@ -409,7 +432,10 @@ def test_try_to_list_all_shared_images_for_invalid_token():
409432
assert "Not found" in result
410433

411434

412-
def test_try_gets_details_about_your_share_group_for_invalid_token():
435+
def test_try_gets_details_about_your_share_group_for_invalid_token(
436+
monkeypatch: MonkeyPatch,
437+
):
438+
monkeypatch.setenv("LINODE_CLI_API_VERSION", "v4beta")
413439
result = exec_failing_test_command(
414440
BASE_CMDS["image-sharegroups"]
415441
+ [

0 commit comments

Comments
 (0)