Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added tests as a part Test Coverage #656

Open
wants to merge 30 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
20698e7
added test for linode_type and account_transfer
vshanthe Dec 20, 2023
5063f19
remove print statment
vshanthe Jan 3, 2024
ba4b2e1
Merge branch 'linode:dev' into dev
vshanthe Jan 10, 2024
0e18929
Merge branch 'linode:dev' into dev
vshanthe Jan 24, 2024
ba9f2ce
Merge branch 'linode:dev' into dev
vshanthe Feb 14, 2024
1269881
Merge branch 'linode:dev' into dev
vshanthe Mar 4, 2024
aa454b0
Merge branch 'linode:dev' into dev
vshanthe Mar 11, 2024
2b2f060
Merge branch 'linode:dev' into dev
vshanthe Mar 13, 2024
50da563
Merge branch 'linode:dev' into dev
vshanthe Mar 18, 2024
2823bf0
Merge branch 'linode:dev' into dev
vshanthe Mar 29, 2024
45915d2
Merge branch 'linode:dev' into dev
vshanthe Apr 12, 2024
cd1fac2
Merge branch 'linode:dev' into dev
vshanthe Apr 29, 2024
7eceff3
Merge branch 'linode:dev' into dev
vshanthe Apr 30, 2024
b91a779
Merge branch 'linode:dev' into dev
vshanthe May 2, 2024
6483c1c
Merge branch 'linode:dev' into dev
vshanthe May 3, 2024
ff1da19
Merge branch 'linode:dev' into dev
vshanthe May 7, 2024
fa1c18c
Merge branch 'linode:dev' into dev
vshanthe Jun 10, 2024
05a39c6
Merge branch 'linode:dev' into dev
vshanthe Jun 19, 2024
b4c33e9
Merge branch 'linode:dev' into dev
vshanthe Jul 11, 2024
71934ba
Merge branch 'linode:dev' into dev
vshanthe Jul 17, 2024
4e2d0c4
Merge branch 'linode:dev' into dev
vshanthe Jul 19, 2024
57e9ace
Merge branch 'linode:dev' into dev
vshanthe Jul 30, 2024
2a16f7a
Merge branch 'linode:dev' into dev
vshanthe Aug 1, 2024
c49197e
Merge branch 'linode:dev' into dev
vshanthe Aug 9, 2024
e1cf42b
Merge branch 'linode:dev' into dev
vshanthe Aug 21, 2024
6393473
Merge branch 'linode:dev' into dev
vshanthe Sep 9, 2024
b72431a
Merge branch 'linode:dev' into dev
vshanthe Sep 17, 2024
7b960c6
Merge branch 'linode:dev' into dev
vshanthe Oct 8, 2024
a91dad9
Merge branch 'linode:dev' into dev
vshanthe Oct 10, 2024
d2bd6c8
test coverage
vshanthe Oct 10, 2024
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
8 changes: 5 additions & 3 deletions linodecli/baked/operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
42 changes: 42 additions & 0 deletions tests/integration/account/test_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
62 changes: 61 additions & 1 deletion tests/integration/image/test_plugin_image_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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)
70 changes: 70 additions & 0 deletions tests/integration/linodes/test_linodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Loading