Ejemplo n.º 1
0
 def test_list_endpoint_not_found(self):
     cfg.CONF.set_override(name='auto_refresh_endpoint', override=False,
                           group='client')
     # delete the configuration so endpoint cannot be found
     api.delete_pod_service_configuration(self.context, FAKE_SERVICE_ID)
     # auto refresh set to False, directly raise exception
     self.assertRaises(exceptions.EndpointNotFound,
                       self.client.list_resources,
                       FAKE_RESOURCE, self.context, [])
Ejemplo n.º 2
0
 def test_list_endpoint_not_found(self):
     cfg.CONF.set_override(name='auto_refresh_endpoint',
                           override=False,
                           group='client')
     # delete the configuration so endpoint cannot be found
     api.delete_pod_service_configuration(self.context, FAKE_SERVICE_ID)
     # auto refresh set to False, directly raise exception
     self.assertRaises(exceptions.EndpointNotFound,
                       self.client.list_resources, FAKE_RESOURCE,
                       self.context, [])
Ejemplo n.º 3
0
    def test_list_endpoint_not_found_retry(self):
        cfg.CONF.set_override(name='auto_refresh_endpoint', override=True,
                              group='client')
        # delete the configuration so endpoint cannot be found
        api.delete_pod_service_configuration(self.context, FAKE_SERVICE_ID)

        self.client._get_admin_token = mock.Mock()
        self.client._get_endpoint_from_keystone = mock.Mock()
        self.client._get_endpoint_from_keystone.return_value = {
            FAKE_SITE_NAME: {FAKE_TYPE: FAKE_URL}
        }

        resources = self.client.list_resources(
            FAKE_RESOURCE, self.context, [])
        self.assertEqual(resources, [{'name': 'res1'}, {'name': 'res2'}])
Ejemplo n.º 4
0
    def test_list_endpoint_not_found_retry(self):
        cfg.CONF.set_override(name='auto_refresh_endpoint',
                              override=True,
                              group='client')
        # delete the configuration so endpoint cannot be found
        api.delete_pod_service_configuration(self.context, FAKE_SERVICE_ID)

        self.client._get_admin_token = mock.Mock()
        self.client._get_endpoint_from_keystone = mock.Mock()
        self.client._get_endpoint_from_keystone.return_value = {
            FAKE_SITE_NAME: {
                FAKE_TYPE: FAKE_URL
            }
        }

        resources = self.client.list_resources(FAKE_RESOURCE, self.context, [])
        self.assertEqual(resources, [{'name': 'res1'}, {'name': 'res2'}])