Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from pytest_httpserver.pytest_plugin import PluginHTTPServer
from vdk.internal import test_utils
from vdk.internal.control.command_groups.job.list import list_command
from vdk.internal.test_utils import assert_click_status

test_utils.disable_vdk_authentication()

Expand Down Expand Up @@ -63,9 +64,7 @@ def test_list_default_all(httpserver: PluginHTTPServer, tmpdir: LocalPath):

runner = CliRunner()
result = runner.invoke(list_command, ["-t", "test-team", "-u", rest_api_url])
assert (
result.exit_code == 0
), f"result exit code is not 0, result output: {result.output}, exc: {result.exc_info}"
assert_click_status(result, 0)
assert (
"test-job" in result.output and "test-job-2" in result.output
), f"expected data not found in output: {result.output} "
Expand All @@ -92,19 +91,15 @@ def test_list_all(httpserver: PluginHTTPServer, tmpdir: LocalPath):

runner = CliRunner()
result = runner.invoke(list_command, ["-t", "test-team", "-a", "-u", rest_api_url])
assert (
result.exit_code == 0
), f"result exit code is not 0, result output: {result.output}, exc: {result.exc_info}"
assert_click_status(result, 0)
assert (
"test-job" in result.output
), f"expected data not found in output: {result.output} "

result = runner.invoke(
list_command, ["-t", "test-team", "--all", "-u", rest_api_url]
)
assert (
result.exit_code == 0
), f"result exit code is not 0, result output: {result.output}, exc: {result.exc_info}"
assert_click_status(result, 0)
assert (
"test-job" in result.output
), f"expected data not found in output: {result.output} "
Expand All @@ -114,9 +109,7 @@ def test_list_all(httpserver: PluginHTTPServer, tmpdir: LocalPath):
).respond_with_json(response)

result = runner.invoke(list_command, ["-u", rest_api_url])
assert (
result.exit_code == 0
), f"result exit code is not 0, result output: {result.output}, exc: {result.exc_info}"
assert_click_status(result, 0)
assert (
"test-job" in result.output
), f"expected data not found in output: {result.output} "
Expand All @@ -125,20 +118,14 @@ def test_list_all(httpserver: PluginHTTPServer, tmpdir: LocalPath):
def test_list_without_url(httpserver: PluginHTTPServer, tmpdir: LocalPath):
runner = CliRunner()
result = runner.invoke(list_command, ["-t", "test-team"])

assert (
result.exit_code == 2
), f"result exit code is not 2, result output: {result.output}, exc: {result.exc_info}"
assert_click_status(result, 2)
assert "what" in result.output and "why" in result.output


def test_list_with_empty_url(httpserver: PluginHTTPServer, tmpdir: LocalPath):
runner = CliRunner()
result = runner.invoke(list_command, ["-t", "test-team", "-u", ""])

assert (
result.exit_code == 2
), f"result exit code is not 2, result output: {result.output}, exc: {result.exc_info}"
assert_click_status(result, 2)
assert "what" in result.output and "why" in result.output


Expand All @@ -155,9 +142,7 @@ def test_list_with_json_output(httpserver: PluginHTTPServer, tmpdir: LocalPath):
result = runner.invoke(
list_command, ["-t", "test-team", "-u", rest_api_url, "-o", "json"]
)
assert (
result.exit_code == 0
), f"result exit code is not 0, result output: {result.output}, exc: {result.exc_info}"
assert_click_status(result, 0)

try:
json_result = json.loads(result.output)
Expand All @@ -175,9 +160,7 @@ def test_list_with_invalid_output(httpserver: PluginHTTPServer, tmpdir: LocalPat
result = runner.invoke(
list_command, ["-t", "test-team", "-u", rest_api_url, "-o", "invalid"]
)
assert (
result.exit_code == 2
), f"result exit code is not 0, result output: {result.output}, exc: {result.exc_info}"
assert_click_status(result, 2)
assert (
"Error: Invalid value for '--output'" in result.output
), f"expected data not found in output: {result.output}"
Expand Down Expand Up @@ -223,9 +206,7 @@ def get_comparing_values(self, request_query_string: bytes) -> tuple:

runner = CliRunner()
result = runner.invoke(list_command, ["-t", "test-team", "-a", "-u", rest_api_url])
assert (
result.exit_code == 0
), f"result exit code is not 0, result output: {result.output}, exc: {result.exc_info}"
assert_click_status(result, 0)
assert (
"test-job-1" in result.output and "test-job-120" in result.output
), f"expected data not found in output: {result.output}"