mirror of
https://github.com/ansible/ansible.git
synced 2026-08-01 00:34:56 +02:00
Fix galaxy CLI unit test assertions (#80504)
This commit is contained in:
@@ -168,7 +168,9 @@ class TestGalaxy(unittest.TestCase):
|
||||
with patch.object(ansible.utils.display.Display, "display", return_value=None) as mocked_display:
|
||||
# testing that error expected is raised
|
||||
self.assertRaises(AnsibleError, gc.run)
|
||||
self.assertTrue(mocked_display.called_once_with("- downloading role 'fake_role_name', owned by "))
|
||||
assert mocked_display.call_count == 2
|
||||
assert mocked_display.mock_calls[0].args[0] == "Starting galaxy role install process"
|
||||
assert "fake_role_name was NOT installed successfully" in mocked_display.mock_calls[1].args[0]
|
||||
|
||||
def test_exit_without_ignore_with_flag(self):
|
||||
''' tests that GalaxyCLI exits without the error specified if the --ignore-errors flag is used '''
|
||||
@@ -176,7 +178,9 @@ class TestGalaxy(unittest.TestCase):
|
||||
gc = GalaxyCLI(args=["ansible-galaxy", "install", "--server=None", "fake_role_name", "--ignore-errors"])
|
||||
with patch.object(ansible.utils.display.Display, "display", return_value=None) as mocked_display:
|
||||
gc.run()
|
||||
self.assertTrue(mocked_display.called_once_with("- downloading role 'fake_role_name', owned by "))
|
||||
assert mocked_display.call_count == 2
|
||||
assert mocked_display.mock_calls[0].args[0] == "Starting galaxy role install process"
|
||||
assert "fake_role_name was NOT installed successfully" in mocked_display.mock_calls[1].args[0]
|
||||
|
||||
def test_parse_no_action(self):
|
||||
''' testing the options parser when no action is given '''
|
||||
|
||||
Reference in New Issue
Block a user