Browse Source

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
tags/11.4.0
Jon Schlueter 2 months ago
parent
commit
a7c7955e52
1 changed files with 7 additions and 2 deletions
  1. 7
    2
      tripleoclient/tests/v1/tripleo/test_tripleo_upgrade.py

+ 7
- 2
tripleoclient/tests/v1/tripleo/test_tripleo_upgrade.py View File

@@ -127,7 +127,9 @@ class TestUpgrade(utils.TestCommand):
127 127
     @mock.patch('tripleoclient.v1.tripleo_deploy.Deploy',
128 128
                 autospec=True)
129 129
     @mock.patch('sys.stdin', spec=six.StringIO)
130
-    def test_take_action_prompt_no(self, mock_stdin, mock_deploy):
130
+    @mock.patch('tripleoclient.utils.ansible_symlink')
131
+    def test_take_action_prompt_no(self, mock_slink, mock_stdin, mock_deploy):
132
+        mock_slink.side_effect = 'fake-cmd'
131 133
         mock_stdin.isatty.return_value = True
132 134
         mock_stdin.readline.return_value = 'n'
133 135
         parsed_args = self.check_parser(self.cmd,
@@ -151,7 +153,10 @@ class TestUpgrade(utils.TestCommand):
151 153
     @mock.patch('tripleoclient.v1.tripleo_deploy.Deploy',
152 154
                 autospec=True)
153 155
     @mock.patch('sys.stdin', spec=six.StringIO)
154
-    def test_take_action_prompt_invalid_option(self, mock_stdin, mock_deploy):
156
+    @mock.patch('tripleoclient.utils.ansible_symlink')
157
+    def test_take_action_prompt_invalid_option(self, mock_slink, mock_stdin,
158
+                                               mock_deploy):
159
+        mock_slink.side_effect = 'fake-cmd'
155 160
         mock_stdin.isatty.return_value = True
156 161
         mock_stdin.readline.return_value = 'Dontwant'
157 162
         parsed_args = self.check_parser(self.cmd,

Loading…
Cancel
Save