Skip to content

Commit

Permalink
test(cli): add tests for CLI apps group (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
hussein-awala authored May 11, 2024
1 parent 92afcca commit 4a0de44
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/cli/test_apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from __future__ import annotations

from unittest import mock

from click.testing import CliRunner

TEST_NAMESPACE = "test-namespace"


@mock.patch("spark_on_k8s.utils.app_manager.SparkAppManager")
def test_list(mock_spark_app_manager):
from spark_on_k8s.cli.apps import list

mock_spark_app_manager().list_apps.return_value = ["app1", "app2", "app3"]
args = ["--namespace", TEST_NAMESPACE]
result = CliRunner().invoke(list, args)
assert result.exit_code == 0
assert result.output == "app1\napp2\napp3\n"
mock_spark_app_manager().list_apps.assert_called_with(namespace=TEST_NAMESPACE)

0 comments on commit 4a0de44

Please sign in to comment.