def test_multiple_services(self, mock_ssh): # An ssh command is executed for each given service. stop_services("127.0.0.1", ["foo", "bar"]) self.assertEqual(2, mock_ssh.call_count) expected = [ mock.call("[email protected]", "sudo", "service", "foo", "stop"), mock.call("[email protected]", "sudo", "service", "bar", "stop"), ] mock_ssh.assert_has_calls(expected)
def test_multiple_services(self, mock_ssh): # An ssh command is executed for each given service. stop_services('127.0.0.1', ['foo', 'bar']) self.assertEqual(2, mock_ssh.call_count) expected = [ mock.call('[email protected]', 'sudo', 'service', 'foo', 'stop'), mock.call('[email protected]', 'sudo', 'service', 'bar', 'stop'), ] mock_ssh.assert_has_calls(expected)
def test_single_service(self, mock_ssh): # An ssh command is executed to stop a single service. stop_services("my-host-name", ["foo"]) mock_ssh.assert_called_once_with("ubuntu@my-host-name", "sudo", "service", "foo", "stop")
def test_single_service(self, mock_ssh): # An ssh command is executed to stop a single service. stop_services('my-host-name', ['foo']) mock_ssh.assert_called_once_with( 'ubuntu@my-host-name', 'sudo', 'service', 'foo', 'stop')
def test_single_service(self, mock_ssh): # An ssh command is executed to stop a single service. stop_services('my-host-name', ['foo']) mock_ssh.assert_called_once_with('ubuntu@my-host-name', 'sudo', 'service', 'foo', 'stop')