def test_create_client_by_catalog(self): CONF.set_default('glance_catalog_info', 'image:glance:publicURL', 'glance_client') CONF.set_default('nova_catalog_info', 'compute:nova:publicURL', 'nova_client') plugin = ImageProtectablePlugin(self._context) self.assertEqual( plugin._glance_client(self._context).http_client.endpoint, 'http://127.0.0.1:9292') self.assertEqual( plugin._nova_client(self._context).client.management_url, 'http://127.0.0.1:8774/v2.1/abcd')
def test_create_client_by_endpoint(self): CONF.set_default('glance_endpoint', 'http://127.0.0.1:9292', 'glance_client') CONF.set_default('nova_endpoint', 'http://127.0.0.1:8774/v2.1', 'nova_client') plugin = ImageProtectablePlugin(self._context) self.assertEqual( plugin._glance_client(self._context).http_client.endpoint, 'http://127.0.0.1:9292') self.assertEqual( plugin._nova_client(self._context).client.management_url, 'http://127.0.0.1:8774/v2.1/abcd')
def test_create_client_by_catalog(self, mock_generate_session): CONF.set_default('glance_catalog_info', 'image:glance:publicURL', 'glance_client') CONF.set_default('nova_catalog_info', 'compute:nova:publicURL', 'nova_client') plugin = ImageProtectablePlugin(self._context) mock_generate_session.return_value = keystone_session.Session( auth=None) self.assertEqual( plugin._glance_client(self._context).http_client.endpoint_override, 'http://127.0.0.1:9292') self.assertEqual( plugin._nova_client(self._context).client.endpoint_override, 'http://127.0.0.1:8774/v2.1/abcd')