diff --git a/test/units/plugins/connections/test_connection.py b/test/units/plugins/connections/test_connection.py index c34fce1d69..88cda0ec50 100644 --- a/test/units/plugins/connections/test_connection.py +++ b/test/units/plugins/connections/test_connection.py @@ -109,18 +109,21 @@ class TestConnectionBaseClass(unittest.TestCase): @mock.patch('ansible.plugins.connection.docker.Connection._old_docker_version', return_value=('false', 'garbage', '', 1)) @mock.patch('ansible.plugins.connection.docker.Connection._new_docker_version', return_value=('docker version', '1.2.3', '', 0)) def test_docker_connection_module_too_old(self, mock_new_docker_verison, mock_old_docker_version): - self.assertRaises(AnsibleError, DockerConnection, self.play_context, self.in_stream) + self.assertRaisesRegexp(AnsibleError, '^docker connection type requires docker 1.3 or higher$', + DockerConnection, self.play_context, self.in_stream, docker_command='/fake/docker') @mock.patch('ansible.plugins.connection.docker.Connection._old_docker_version', return_value=('false', 'garbage', '', 1)) @mock.patch('ansible.plugins.connection.docker.Connection._new_docker_version', return_value=('docker version', '1.3.4', '', 0)) def test_docker_connection_module(self, mock_new_docker_verison, mock_old_docker_version): - self.assertIsInstance(DockerConnection(self.play_context, self.in_stream), DockerConnection) + self.assertIsInstance(DockerConnection(self.play_context, self.in_stream, docker_command='/fake/docker'), + DockerConnection) # old version and new version fail @mock.patch('ansible.plugins.connection.docker.Connection._old_docker_version', return_value=('false', 'garbage', '', 1)) @mock.patch('ansible.plugins.connection.docker.Connection._new_docker_version', return_value=('false', 'garbage', '', 1)) def test_docker_connection_module_wrong_cmd(self, mock_new_docker_version, mock_old_docker_version): - self.assertRaises(AnsibleError, DockerConnection, self.play_context, self.in_stream) + self.assertRaisesRegexp(AnsibleError, '^Docker version check (.*?) failed: ', + DockerConnection, self.play_context, self.in_stream, docker_command='/fake/docker') # def test_winrm_connection_module(self): # self.assertIsInstance(WinRmConnection(), WinRmConnection)