def test_cli_print_version_info(): """Make sure the CLI prints version info properly""" user_inputs = ["-V"] with pytest.raises(SystemExit) as pytest_wrapped_exit: cli_parser(user_inputs) assert pytest_wrapped_exit.type == SystemExit assert pytest_wrapped_exit.value.code == 0
def test_cli_command_raise_value_error_when_no_creds_provided(): """Make sure the CLI raise exception about the auth when no creds provided.""" user_inputs = [ "submit", "--wdl-file", "fake.wdl", "--inputs-files", "fake.json" ] with pytest.raises(ValueError): command, args = cli_parser(user_inputs)
def test_cli_abort_command(no_auth): """Test the abort command (with no-auth for simplicity).""" user_inputs = ["abort", "--uuid", "00000000-0000-0000-0000-000000000000" ] + no_auth command, args = cli_parser(user_inputs) assert command.__name__ == "abort" assert args["uuid"] == "00000000-0000-0000-0000-000000000000"
def test_cli_command_works_with_no_auth(no_auth): """Use the submit command as an example to prove CLI works with u/p auth.""" user_inputs = [ "submit", "--wdl-file", "fake.wdl", "--inputs-files", "fake.json", ] + no_auth command, args = cli_parser(user_inputs)
def test_cli_task_runtime_command(no_auth): """Test the task_runtime command (with no-auth for simplicity).""" user_inputs = [ "task_runtime", "--uuid", "00000000-0000-0000-0000-000000000000", ] + no_auth command, args = cli_parser(user_inputs) assert command.__name__ == "run" # task_runtime's entrypoint is run() assert args["uuid"] == "00000000-0000-0000-0000-000000000000"
def test_cli_release_hold_command(no_auth): """Test the release hold command (with no-auth for simplicity).""" user_inputs = [ "release_hold", "--uuid", "00000000-0000-0000-0000-000000000000", ] + no_auth command, args = cli_parser(user_inputs) assert command.__name__ == "release_hold" assert args["uuid"] == "00000000-0000-0000-0000-000000000000"
def test_cli_wait_command(no_auth): """Test the wait command (with no-auth for simplicity).""" user_inputs = [ "wait", "--poll-interval-seconds", "10", "00000000-0000-0000-0000-000000000000", "00000000-0000-0000-0000-000000000000", ] + no_auth command, args = cli_parser(user_inputs) assert command.__name__ == "wait" assert "00000000-0000-0000-0000-000000000000" in args["workflow_ids"]
def test_cli_metadata_command(no_auth): """Test the metadata command (with no-auth for simplicity).""" user_inputs = [ "metadata", "--uuid", "00000000-0000-0000-0000-000000000000", "--includeKey", "jobId", ] + no_auth command, args = cli_parser(user_inputs) assert command.__name__ == "metadata" assert args["uuid"] == "00000000-0000-0000-0000-000000000000" assert "jobId" in args["includeKey"]
def test_cli_submit_command(no_auth): """Test the submit command (with no-auth for simplicity).""" user_inputs = [ "submit", "--wdl-file", "fake.wdl", "--inputs-files", "fake.json", ] + no_auth command, args = cli_parser(user_inputs) assert command.__name__ == "submit" assert args['wdl_file'] == "fake.wdl" assert "fake.json" in args['inputs_files']
def test_cli_command_works_with_service_account_auth(mock_header, service_account_auth): """Use the submit command as an example to prove CLI works with u/p auth.""" expected_auth = CromwellAuth( url="https://fake-cromwell", header={"Authorization": "bearer fake_token"}, auth=None, ) mock_header.return_value = expected_auth user_inputs = [ "submit", "--wdl-file", "fake.wdl", "--inputs-files", "fake.json", ] + service_account_auth command, args = cli_parser(user_inputs)
def test_cli_health_command(no_auth): """Test the health command (with no-auth for simplicity).""" user_inputs = ["health"] + no_auth command, args = cli_parser(user_inputs) assert command.__name__ == "health"