Skip to content

Commit

Permalink
fix: tests pass with CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
sg-s committed Nov 19, 2024
1 parent ec02844 commit fe8a94e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1,045 deletions.
1 change: 1 addition & 0 deletions src/cli/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ def describe(self):
data = api.describe_row(
row_id=self.app.pargs.object_id,
client=self._get_client(),
fields=False,
)

data.pop("row_json_schema", None)
Expand Down
1,038 changes: 0 additions & 1,038 deletions tests/fixtures/responses/convert_id_format.json

This file was deleted.

10 changes: 5 additions & 5 deletions tests/test_cli_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
def test_data(config): # noqa: F811
stdout = _run_cli_command(
["data"],
config["client"],
client=config["client"],
)

assert "List data in the data hub on Deep Origin" in stdout, "Unexpected output"
Expand All @@ -42,7 +42,7 @@ def test_describe_file(config, json_option): # noqa: F811

stdout = _run_cli_command(
["data", "describe", file_id] + json_option,
config["client"],
client=config["client"],
)

if json_option == ["--json"]:
Expand All @@ -56,7 +56,7 @@ def test_describe_row(config, option): # noqa: F811

stdout = _run_cli_command(
["data", "describe", row_id] + option,
config["client"],
client=config["client"],
)
assert row_id in stdout, "Expected to see row_id in output"

Expand All @@ -74,7 +74,7 @@ def test_describe_row(config, option): # noqa: F811
def test_list(config, list_option, json_option): # noqa: F811
stdout = _run_cli_command(
["data", "list"] + list_option + json_option,
config["client"],
client=config["client"],
)

# check that we can parse into JSON
Expand All @@ -86,7 +86,7 @@ def test_list(config, list_option, json_option): # noqa: F811
def test_show_db(config, json_option): # noqa: F811
stdout = _run_cli_command(
["data", "show", config["databases"][0]] + json_option,
config["client"],
client=config["client"],
)

if json_option == ["--json"]:
Expand Down
10 changes: 8 additions & 2 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@


@beartype
def _run_cli_command(argv: list[str], client) -> str:
def _run_cli_command(
argv: list[str],
*,
client,
) -> str:
"""helper function to run a CLI command, parse output and return"""
stdout = io.StringIO()
stderr = io.StringIO()
Expand Down Expand Up @@ -100,7 +104,9 @@ def minimal_config(pytestconfig):
with DBs on a live instance where the config happens
in the test"""

data = dict()
data = dict(
stash=pytestconfig.getoption("responses") == "stash",
)

# set up client
if pytestconfig.getoption("client") == "mock":
Expand Down

0 comments on commit fe8a94e

Please sign in to comment.