Add 2 missing guards for sudo

in running unittests on box with no sudo and
ansible 3 symlink missing ran into this issue.

There were 2 missing mock guards on unittests
that triggered this edge case

Change-Id: Ic4869cf8544e96bc38b26923fadc13be7c0970f9
Closes-Bug: #1819217
This commit is contained in:
Jon Schlueter 2019-03-08 15:49:45 -05:00 committed by Alex Schultz
parent ea03eb966f
commit a7c7955e52
1 changed files with 7 additions and 2 deletions

View File

@ -127,7 +127,9 @@ class TestUpgrade(utils.TestCommand):
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy',
autospec=True)
@mock.patch('sys.stdin', spec=six.StringIO)
def test_take_action_prompt_no(self, mock_stdin, mock_deploy):
@mock.patch('tripleoclient.utils.ansible_symlink')
def test_take_action_prompt_no(self, mock_slink, mock_stdin, mock_deploy):
mock_slink.side_effect = 'fake-cmd'
mock_stdin.isatty.return_value = True
mock_stdin.readline.return_value = 'n'
parsed_args = self.check_parser(self.cmd,
@ -151,7 +153,10 @@ class TestUpgrade(utils.TestCommand):
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy',
autospec=True)
@mock.patch('sys.stdin', spec=six.StringIO)
def test_take_action_prompt_invalid_option(self, mock_stdin, mock_deploy):
@mock.patch('tripleoclient.utils.ansible_symlink')
def test_take_action_prompt_invalid_option(self, mock_slink, mock_stdin,
mock_deploy):
mock_slink.side_effect = 'fake-cmd'
mock_stdin.isatty.return_value = True
mock_stdin.readline.return_value = 'Dontwant'
parsed_args = self.check_parser(self.cmd,