Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion tests/integration/sharegroups/fixtures.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest
from pytest import MonkeyPatch

from tests.integration.helpers import (
BASE_CMDS,
Expand Down Expand Up @@ -120,7 +121,8 @@ def create_image_id(get_region):


@pytest.fixture(scope="function")
def create_share_group():
def create_share_group(monkeypatch: MonkeyPatch):
monkeypatch.setenv("LINODE_CLI_API_VERSION", "v4beta")
label = get_random_text(8) + "_sharegroup_cli_test"
share_group = exec_test_command(
BASE_CMDS["image-sharegroups"]
Expand Down
58 changes: 42 additions & 16 deletions tests/integration/sharegroups/test_images_sharegroups.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from pytest import MonkeyPatch

from linodecli.exit_codes import ExitCodes
from tests.integration.helpers import (
BASE_CMDS,
Expand All @@ -15,7 +17,8 @@
)


def test_help_image_sharegroups():
def test_help_image_sharegroups(monkeypatch: MonkeyPatch):
monkeypatch.setenv("LINODE_CLI_API_VERSION", "v4beta")
output = exec_test_command(
BASE_CMDS["image-sharegroups"] + ["--help", "--text", "--delimiter=,"]
)
Expand Down Expand Up @@ -45,7 +48,8 @@ def test_help_image_sharegroups():
assert_help_actions_list(actions, output)


def test_list_all_share_groups():
def test_list_all_share_groups(monkeypatch: MonkeyPatch):
monkeypatch.setenv("LINODE_CLI_API_VERSION", "v4beta")
result = exec_test_command(
BASE_CMDS["image-sharegroups"] + ["list", "--delimiter", ",", "--text"]
)
Expand All @@ -63,8 +67,9 @@ def test_list_all_share_groups():


def test_add_list_update_remove_image_to_share_group(
create_share_group, create_image_id
create_share_group, create_image_id, monkeypatch: MonkeyPatch
):
monkeypatch.setenv("LINODE_CLI_API_VERSION", "v4beta")
result_add_image = exec_test_command(
BASE_CMDS["image-sharegroups"]
+ [
Expand Down Expand Up @@ -153,7 +158,10 @@ def test_add_list_update_remove_image_to_share_group(
delete_target_id(target="linodes", id=create_image_id[0])


def test_try_add_member_use_invalid_token(create_share_group):
def test_try_add_member_use_invalid_token(
create_share_group, monkeypatch: MonkeyPatch
):
monkeypatch.setenv("LINODE_CLI_API_VERSION", "v4beta")
result = exec_failing_test_command(
BASE_CMDS["image-sharegroups"]
+ [
Expand All @@ -175,7 +183,10 @@ def test_try_add_member_use_invalid_token(create_share_group):
delete_target_id(target="image-sharegroups", id=create_share_group[0])


def test_list_members_for_invalid_token(create_share_group):
def test_list_members_for_invalid_token(
create_share_group, monkeypatch: MonkeyPatch
):
monkeypatch.setenv("LINODE_CLI_API_VERSION", "v4beta")
result = exec_test_command(
BASE_CMDS["image-sharegroups"]
+ [
Expand All @@ -194,7 +205,8 @@ def test_list_members_for_invalid_token(create_share_group):
delete_target_id(target="image-sharegroups", id=create_share_group[0])


def test_try_revoke_membership_for_invalid_token():
def test_try_revoke_membership_for_invalid_token(monkeypatch: MonkeyPatch):
monkeypatch.setenv("LINODE_CLI_API_VERSION", "v4beta")
result = exec_failing_test_command(
BASE_CMDS["image-sharegroups"]
+ [
Expand All @@ -212,7 +224,8 @@ def test_try_revoke_membership_for_invalid_token():
assert "Not found" in result


def test_try_update_membership_for_invalid_token():
def test_try_update_membership_for_invalid_token(monkeypatch: MonkeyPatch):
monkeypatch.setenv("LINODE_CLI_API_VERSION", "v4beta")
result = exec_failing_test_command(
BASE_CMDS["image-sharegroups"]
+ [
Expand All @@ -232,7 +245,8 @@ def test_try_update_membership_for_invalid_token():
assert "Not found" in result


def test_try_view_membership_for_invalid_token():
def test_try_view_membership_for_invalid_token(monkeypatch: MonkeyPatch):
monkeypatch.setenv("LINODE_CLI_API_VERSION", "v4beta")
result = exec_failing_test_command(
BASE_CMDS["image-sharegroups"]
+ [
Expand All @@ -250,7 +264,8 @@ def test_try_view_membership_for_invalid_token():
assert "Not found" in result


def test_create_read_update_delete_share_group():
def test_create_read_update_delete_share_group(monkeypatch: MonkeyPatch):
monkeypatch.setenv("LINODE_CLI_API_VERSION", "v4beta")
group_label = get_random_text(8) + "_sharegroup_cli_test"
create_result = exec_test_command(
BASE_CMDS["image-sharegroups"]
Expand Down Expand Up @@ -316,7 +331,8 @@ def test_create_read_update_delete_share_group():
assert "Not found" in result_after_delete


def test_try_to_create_token(create_share_group):
def test_try_to_create_token(create_share_group, monkeypatch: MonkeyPatch):
monkeypatch.setenv("LINODE_CLI_API_VERSION", "v4beta")
share_group_uuid = create_share_group[1]
result = exec_failing_test_command(
BASE_CMDS["image-sharegroups"]
Expand All @@ -338,7 +354,8 @@ def test_try_to_create_token(create_share_group):
delete_target_id(target="image-sharegroups", id=create_share_group[0])


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


def test_try_to_update_invalid_token():
def test_try_to_update_invalid_token(monkeypatch: MonkeyPatch):
monkeypatch.setenv("LINODE_CLI_API_VERSION", "v4beta")
result = exec_failing_test_command(
BASE_CMDS["image-sharegroups"]
+ [
Expand All @@ -366,7 +384,8 @@ def test_try_to_update_invalid_token():
assert "Not found" in result


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


def test_get_details_about_all_the_users_tokens():
def test_get_details_about_all_the_users_tokens(monkeypatch: MonkeyPatch):
monkeypatch.setenv("LINODE_CLI_API_VERSION", "v4beta")
result = exec_test_command(
BASE_CMDS["image-sharegroups"]
+ ["tokens-list", "--delimiter", ",", "--text"]
Expand All @@ -393,7 +413,10 @@ def test_get_details_about_all_the_users_tokens():
assert_headers_in_lines(headers, lines)


def test_try_to_list_all_shared_images_for_invalid_token():
def test_try_to_list_all_shared_images_for_invalid_token(
monkeypatch: MonkeyPatch,
):
monkeypatch.setenv("LINODE_CLI_API_VERSION", "v4beta")
result = exec_failing_test_command(
BASE_CMDS["image-sharegroups"]
+ [
Expand All @@ -409,7 +432,10 @@ def test_try_to_list_all_shared_images_for_invalid_token():
assert "Not found" in result


def test_try_gets_details_about_your_share_group_for_invalid_token():
def test_try_gets_details_about_your_share_group_for_invalid_token(
monkeypatch: MonkeyPatch,
):
monkeypatch.setenv("LINODE_CLI_API_VERSION", "v4beta")
result = exec_failing_test_command(
BASE_CMDS["image-sharegroups"]
+ [
Expand Down