testing GalaxyCLI.run() does what is expected
This commit is contained in:
parent
b688f11474
commit
28b4931e3d
1 changed files with 14 additions and 0 deletions
|
@ -112,6 +112,20 @@ class TestGalaxy(unittest.TestCase):
|
|||
if display_result.find('\n\tgalaxy_info:') == -1:
|
||||
self.fail('Expected galaxy_info to be indented once')
|
||||
|
||||
def test_run(self):
|
||||
''' verifies that the GalaxyCLI object's api is created and that execute() is called. '''
|
||||
gc = GalaxyCLI(args=["install"])
|
||||
with patch('sys.argv', ["-c", "-v", '--ignore-errors', 'imaginary_role']):
|
||||
galaxy_parser = gc.parse()
|
||||
with patch.object(ansible.cli.CLI, "execute", return_value=None) as mock_ex:
|
||||
with patch.object(ansible.cli.CLI, "run", return_value=None) as mock_run:
|
||||
gc.run()
|
||||
|
||||
# testing
|
||||
self.assertEqual(mock_run.call_count, 1)
|
||||
self.assertTrue(isinstance(gc.api, ansible.galaxy.api.GalaxyAPI))
|
||||
self.assertEqual(mock_ex.call_count, 1)
|
||||
|
||||
def test_execute_remove(self):
|
||||
# installing role
|
||||
gc = GalaxyCLI(args=["install", "--offline", "-p", self.role_path, "-r", self.role_req])
|
||||
|
|
Loading…
Reference in a new issue