Fix test_utils error due unmocked subprocess call

While I could have just added check_output=True in the call, it seemed
good to check the other call path. Seems related to this change:
cb7ed2f48c
This commit is contained in:
John Garbutt 2017-08-17 17:30:38 +01:00
parent a3d1b07652
commit a97c41b2f4

View File

@ -91,8 +91,8 @@ key2: value2
mock_output.assert_called_once_with(["command", "to", "run"])
self.assertEqual(output, "command output")
@mock.patch.object(subprocess, "check_output")
def test_run_command_failure(self, mock_output):
mock_output.side_effect = subprocess.CalledProcessError(1, "command")
@mock.patch.object(subprocess, "check_call")
def test_run_command_failure(self, mock_call):
mock_call.side_effect = subprocess.CalledProcessError(1, "command")
self.assertRaises(subprocess.CalledProcessError, utils.run_command,
["command", "to", "run"])