Skip to content

Commit

Permalink
SNOW-1011764: Adding integration test for show/drop image repository
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-davwang committed Jan 31, 2024
1 parent 07d2c73 commit 74e028e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/object/test_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ def test_that_objects_list_is_in_help(command, runner):
for obj in SUPPORTED_OBJECTS:
if command == "describe" and obj == "image-repository":
assert obj not in result.output, f"{obj} should not be in help message"
assert obj in result.output, f"{obj} in help message"
else:
assert obj in result.output, f"{obj} in help message"


@pytest.mark.parametrize(
Expand Down
28 changes: 28 additions & 0 deletions tests_integration/test_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,31 @@ def test_object_table(runner, test_database, snowflake_session):
assert (
len(row_from_cursor(snowflake_session.execute_string(f"show tables")[-1])) == 0
)


@pytest.mark.integration
def test_show_drop_image_repository(runner, test_database, snowflake_session):
repo_name = "TEST_REPO"

result_create = runner.invoke_with_connection(
["sql", "-q", f"create image repository {repo_name}"]
)
assert result_create.exit_code == 0, result_create.output
assert f"Image Repository {repo_name} successfully created" in result_create.output

result_show = runner.invoke_with_connection(
["object", "list", "image-repository", "--format", "json"]
)
curr = snowflake_session.execute_string(f"show image repositories")
expected = row_from_cursor(curr[-1])
actual = result_show.json

assert len(actual) == len(expected)
assert actual[0].keys() == expected[0].keys()
assert actual[0]["name"] == expected[0]["name"]

result_drop = runner.invoke_with_connection(
["object", "drop", "image-repository", repo_name]
)
assert result_drop.exit_code == 0, result_drop.output
assert f"{repo_name} successfully dropped" in result_drop.output

0 comments on commit 74e028e

Please sign in to comment.