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

vdk-control-cli: Make list command print all jobs on empty team param #709

Merged
merged 5 commits into from
Feb 17, 2022
Merged
Show file tree
Hide file tree
Changes from 3 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 @@ -207,8 +207,6 @@ class FilterOperation(Enum):
type=click.STRING,
default=load_default_team_name(),
cls=NotRequiredIfAllOperationExists,
required=True,
prompt="Job Team",
help="The name of the team that Data Jobs belong to in the searched list."
" Not required if (-a,--all) option is provided.",
)
Expand Down Expand Up @@ -237,6 +235,7 @@ def list_command(
cmd = JobList(rest_api_url)
if team is None:
team = "no-team-specified"
operation_all = FilterOperation.ALL.value
cmd.list_jobs(
team, (operation_all == FilterOperation.ALL.value), more_details, output
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@


@click.command(
short_help="Logout the user from the Data Jobs Service.",
help="Logout the user from the Data Jobs Service by deleting their refresh token stored locally.",
short_help="Logout the user from the Control Service.",
help="Logout the user from the Control Service by deleting their refresh token stored locally.",
)
def logout():
conf = VDKConfigFolder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,18 @@ def test_list_all(httpserver: PluginHTTPServer, tmpdir: LocalPath):
"test-job" in result.output
), f"expected data not found in output: {result.output} "

httpserver.expect_request(
uri="/data-jobs/for-team/no-team-specified/jobs",
).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 (
"test-job" in result.output
), f"expected data not found in output: {result.output} "


def test_list_without_url(httpserver: PluginHTTPServer, tmpdir: LocalPath):
runner = CliRunner()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
from vdk.plugin.control_cli_plugin import control_service_configuration


@hookimpl
@hookimpl(
tryfirst=True
) # hook will be tried first so any hooks which decorate these commands will be able to function
gageorgiev marked this conversation as resolved.
Show resolved Hide resolved
def vdk_command_line(root_command: click.Group):
root_command.add_command(login)
root_command.add_command(logout)
Expand All @@ -50,7 +52,6 @@ def vdk_command_line(root_command: click.Group):

@hookimpl(tryfirst=True)
def vdk_configure(config_builder: ConfigurationBuilder) -> None:
""""""
control_service_configuration.add_definitions(config_builder)


Expand Down