Skip to content

Commit

Permalink
coverage for non exist golden path
Browse files Browse the repository at this point in the history
  • Loading branch information
wen587 committed Sep 19, 2022
1 parent 318fcc8 commit 416c29a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/config_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,17 @@ def is_file_side_effect(filename):
assert result.exit_code == 0
assert expected_output in result.output

def test_load_minigraph_with_non_exist_golden_config_path(self, get_cmd_module):
def is_file_side_effect(filename):
return True if 'golden_config' in filename else False
with mock.patch("utilities_common.cli.run_command", mock.MagicMock(side_effect=mock_run_command_side_effect)) as mock_run_command, \
mock.patch('os.path.isfile', mock.MagicMock(side_effect=is_file_side_effect)):
(config, show) = get_cmd_module
runner = CliRunner()
result = runner.invoke(config.config.commands["load_minigraph"], ["-p", "non_exist.json", "-y"])
assert result.exit_code != 0
assert "Cannot find 'non_exist.json'" in result.output

def test_load_minigraph_with_golden_config_path(self, get_cmd_module):
def is_file_side_effect(filename):
return True if 'golden_config' in filename else False
Expand Down

0 comments on commit 416c29a

Please sign in to comment.