def test_warn_external_ip(self, mock_warn, mock_nodeuuid): env.host = 'node' client_mock = MagicMock(PrestoClient) client_mock.run_sql.return_value = [['IP1'], ['IP2']] server.get_ext_ip_of_node(client_mock) mock_warn.assert_called_with("More than one external ip found for " "node. There could be multiple nodes " "associated with the same node.id")
def test_get_external_ip(self, mock_nodeuuid): client_mock = MagicMock(PrestoClient) client_mock.execute_query.return_value = True client_mock.get_rows = lambda: [['IP']] self.assertEqual(server.get_ext_ip_of_node(client_mock), 'IP')
def test_get_external_ip(self, mock_nodeuuid): client_mock = MagicMock(PrestoClient) client_mock.run_sql.return_value = [['IP']] self.assertEqual(server.get_ext_ip_of_node(client_mock), 'IP')