Fix galaxy CLI unit test assertions (#80504)

pull/80511/head
Matt Clay 3 years ago committed by GitHub
parent 3ec828703f
commit 43c5cbcaef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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 '''

Loading…
Cancel
Save