def test_private_link_response(self):
        discovery = HazelcastCloudDiscovery(
            *get_params(HOST, self.server.port, CLOUD_URL, PRIVATE_LINK_TOKEN))
        discovery._ctx = self.ctx
        addresses = discovery.discover_nodes()

        six.assertCountEqual(self, PRIVATE_LINK_ADDRESSES, addresses)
    def test_found_response(self):
        discovery = HazelcastCloudDiscovery(
            *get_params(HOST, self.server.port, CLOUD_URL, TOKEN))
        discovery._ctx = self.ctx
        addresses = discovery.discover_nodes()

        six.assertCountEqual(self, ADDRESSES, addresses)
 def test_refresh_with_exception(self):
     cloud_discovery = HazelcastCloudDiscovery("", 0)
     cloud_discovery.discover_nodes = self.mock_discover_nodes_with_exception
     provider = HazelcastCloudAddressProvider("", 0)
     provider.cloud_discovery = cloud_discovery
     provider.refresh()
 def test_refresh_with_exception(self):
     cloud_discovery = HazelcastCloudDiscovery("", "", 0)
     cloud_discovery.discover_nodes = self.mock_discover_nodes_with_exception
     translator = HazelcastCloudAddressTranslator("", "", 0)
     translator.cloud_discovery = cloud_discovery
     translator.refresh()
 def test_invalid_certificates(self):
     discovery = HazelcastCloudDiscovery(
         *get_params(HOST, self.server.port, CLOUD_URL, TOKEN))
     with self.assertRaises(HazelcastCertificationError):
         discovery.discover_nodes()
 def test_invalid_url(self):
     discovery = HazelcastCloudDiscovery(
         *get_params(HOST, self.server.port, "/INVALID_URL", ""))
     discovery._ctx = self.ctx
     with self.assertRaises(IOError):
         discovery.discover_nodes()
 def test_not_found_response(self):
     discovery = HazelcastCloudDiscovery(
         *get_params(HOST, self.server.port, CLOUD_URL, "INVALID_TOKEN"))
     discovery._ctx = self.ctx
     with self.assertRaises(IOError):
         discovery.discover_nodes()