Skip to content

Commit 93dfb4d

Browse files
committed
Fix integration tests and typo
1 parent ab5444a commit 93dfb4d

File tree

3 files changed

+31
-15
lines changed

3 files changed

+31
-15
lines changed

exasol/toolbox/tools/issue.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def update_issue(
7070
help="target directory to install the issue to.",
7171
),
7272
confirm: bool = typer.Option(
73-
False, help="Automatically confirm overwritting exsisting issue(s)"
73+
False, help="Automatically confirm overwriting existing issue(s)"
7474
),
7575
) -> None:
7676
"""Similar to install but checks for existing issues and shows diff"""

test/integration/tools/issue_test.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from unittest.mock import patch
2+
13
from exasol.toolbox.tools.issue import CLI
24

35

@@ -71,14 +73,20 @@ def test_install_twice_no_error(cli_runner, tmp_path):
7173

7274
class TestUpdateIssue:
7375
@staticmethod
74-
def test_default_wants_user_interaction(cli_runner, tmp_path):
76+
def test_when_file_does_not_previously_exist(cli_runner, tmp_path):
77+
result = cli_runner.invoke(CLI, ["update", "bug", str(tmp_path)])
78+
79+
assert result.exit_code == 0
80+
assert result.output.strip() == f"Updated bug in \n{tmp_path}/bug.md"
81+
82+
@staticmethod
83+
def test_with_existing_file(cli_runner, tmp_path):
7584
# set up with file in tmp_path so bug files are the same
7685
cli_runner.invoke(CLI, ["install", "bug", str(tmp_path)])
7786

78-
result = cli_runner.invoke(CLI, ["update", "bug", str(tmp_path)])
87+
with patch("typer.confirm", return_value=False):
88+
result = cli_runner.invoke(CLI, ["update", "bug", str(tmp_path)])
7989

80-
assert result.exit_code == 1
81-
assert (
82-
result.output.strip()
83-
== "issue <bug> already exists, show diff? [y/N]:Aborted."
84-
)
90+
assert result.exit_code == 0
91+
# files are identical, so no output expected
92+
assert result.output.strip() == ""

test/integration/tools/workflow_test.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from unittest.mock import patch
2+
13
from exasol.toolbox.tools.workflow import CLI
24

35

@@ -95,14 +97,20 @@ def test_install_twice_no_error(cli_runner, tmp_path):
9597

9698
class TestUpdateWorkflow:
9799
@staticmethod
98-
def test_default_wants_user_interaction(cli_runner, tmp_path):
100+
def test_when_file_does_not_previously_exist(cli_runner, tmp_path):
101+
result = cli_runner.invoke(CLI, ["update", "checks", str(tmp_path)])
102+
103+
assert result.exit_code == 0
104+
assert result.output.strip() == f"Updated checks in \n{tmp_path}/checks.yml"
105+
106+
@staticmethod
107+
def test_with_existing_file(cli_runner, tmp_path):
99108
# set up with file in tmp_path so checks files are the same
100109
cli_runner.invoke(CLI, ["install", "checks", str(tmp_path)])
101110

102-
result = cli_runner.invoke(CLI, ["update", "checks", str(tmp_path)])
111+
with patch("typer.confirm", return_value=False):
112+
result = cli_runner.invoke(CLI, ["update", "checks", str(tmp_path)])
103113

104-
assert result.exit_code == 1
105-
assert (
106-
result.output.strip()
107-
== "workflow <checks> already exists, show diff? [y/N]:Aborted."
108-
)
114+
assert result.exit_code == 0
115+
# files are identical, so no output expected
116+
assert result.output.strip() == ""

0 commit comments

Comments
 (0)