diff --git a/linodecli/baked/operation.py b/linodecli/baked/operation.py index 1494792cc..218b9059c 100644 --- a/linodecli/baked/operation.py +++ b/linodecli/baked/operation.py @@ -366,9 +366,11 @@ def __init__( if param.name not in {"apiVersion"} ] - self.url_base, self.url_path, self.default_api_version = ( - self._get_api_url_components(operation, params) - ) + ( + self.url_base, + self.url_path, + self.default_api_version, + ) = self._get_api_url_components(operation, params) self.url = self.url_base + self.url_path diff --git a/tests/integration/account/test_account.py b/tests/integration/account/test_account.py index f262652d5..2d7bc3348 100644 --- a/tests/integration/account/test_account.py +++ b/tests/integration/account/test_account.py @@ -316,3 +316,45 @@ def test_service_transfers(): headers = ["token", "expiry", "is_sender"] assert_headers_in_lines(headers, lines) + + +def test_maintenance_list(): + res = ( + exec_test_command( + BASE_CMD + ["maintenance-list", "--text", "--delimiter=,"] + ) + .stdout.decode() + .rstrip() + ) + lines = res.splitlines() + + headers = ["entity.type", "entity.label"] + assert_headers_in_lines(headers, lines) + + +def test_notifications_list(): + res = ( + exec_test_command( + BASE_CMD + ["notifications-list", "--text", "--delimiter=,"] + ) + .stdout.decode() + .rstrip() + ) + lines = res.splitlines() + + headers = ["label", "severity"] + assert_headers_in_lines(headers, lines) + + +def test_clients_list(): + res = ( + exec_test_command( + BASE_CMD + ["clients-list", "--text", "--delimiter=,"] + ) + .stdout.decode() + .rstrip() + ) + lines = res.splitlines() + + headers = ["label", "status"] + assert_headers_in_lines(headers, lines) diff --git a/tests/integration/image/test_plugin_image_upload.py b/tests/integration/image/test_plugin_image_upload.py index e17b5130a..29f05b538 100644 --- a/tests/integration/image/test_plugin_image_upload.py +++ b/tests/integration/image/test_plugin_image_upload.py @@ -8,7 +8,7 @@ import pytest -from tests.integration.helpers import get_random_text +from tests.integration.helpers import assert_headers_in_lines, get_random_text REGION = "us-iad" BASE_CMD = ["linode-cli", "image-upload", "--region", REGION] @@ -135,3 +135,63 @@ def test_file_upload_cloud_init( # Delete the image process = exec_test_command(["linode-cli", "images", "rm", image[0]["id"]]) assert process.returncode == 0 + + +def test_image_list(): + res = ( + exec_test_command( + ["linode-cli", "images", "list", "--text", "--delimiter=,"] + ) + .stdout.decode() + .rstrip() + ) + lines = res.splitlines() + + headers = ["label", "description"] + assert_headers_in_lines(headers, lines) + + +@pytest.fixture +def get_image_id(): + image_id = ( + exec_test_command( + [ + "linode-cli", + "images", + "list", + "--text", + "--no-headers", + "--delimiter", + ",", + "--format", + "id", + ] + ) + .stdout.decode() + .rstrip() + .splitlines() + ) + first_id = image_id[0].split(",")[0] + yield first_id + + +def test_image_view(get_image_id): + image_id = get_image_id + res = ( + exec_test_command( + [ + "linode-cli", + "images", + "view", + image_id, + "--text", + "--delimiter=,", + ] + ) + .stdout.decode() + .rstrip() + ) + lines = res.splitlines() + + headers = ["label", "description"] + assert_headers_in_lines(headers, lines) diff --git a/tests/integration/linodes/test_linodes.py b/tests/integration/linodes/test_linodes.py index 4f336363b..8444ce1fd 100644 --- a/tests/integration/linodes/test_linodes.py +++ b/tests/integration/linodes/test_linodes.py @@ -5,6 +5,7 @@ from linodecli.exit_codes import ExitCodes from tests.integration.helpers import ( + assert_headers_in_lines, delete_target_id, exec_failing_test_command, exec_test_command, @@ -167,3 +168,72 @@ def test_add_tag_to_linode(setup_linodes): ).stdout.decode() assert unique_tag in result + + +def list_disk_list(setup_linodes): + linode_id = setup_linodes + res = ( + exec_test_command( + BASE_CMD + + [ + "disks-list", + linode_id, + "--text", + "--delimiter=,", + ] + ) + .stdout.decode() + .rstrip() + ) + lines = res.splitlines() + + headers = ["id", "label"] + assert_headers_in_lines(headers, lines) + + +@pytest.fixture +def get_disk_id(setup_linodes): + linode_id = setup_linodes + disk_id = ( + exec_test_command( + BASE_CMD + + [ + "disks-list", + linode_id, + "--text", + "--no-headers", + "--delimiter", + ",", + "--format", + "id", + ] + ) + .stdout.decode() + .rstrip() + .splitlines() + ) + first_id = disk_id[0].split(",")[0] + yield first_id + + +def test_disk_view(setup_linodes, get_disk_id): + linode_id = setup_linodes + disk_id = get_disk_id + res = ( + exec_test_command( + BASE_CMD + + [ + "disk-view", + linode_id, + disk_id, + "--text", + "--delimiter=,", + ] + ) + .stdout.decode() + .rstrip() + ) + lines = res.splitlines() + + headers = ["id", "label"] + assert_headers_in_lines(headers, lines)