コード例 #1
0
 def test_user_can_get_an_endpoint_group(self):
     endpoint_group = unit.new_endpoint_group_ref(
         filters={'interface': 'public'})
     endpoint_group = PROVIDERS.catalog_api.create_endpoint_group(
         endpoint_group['id'], endpoint_group)
     with self.test_client() as c:
         c.get('/v3/OS-EP-FILTER/endpoint_groups/%s' % endpoint_group['id'],
               headers=self.headers)
コード例 #2
0
ファイル: test_endpoint_group.py プロジェクト: Boye-Z/123
    def test_user_cannot_list_endpoint_groups(self):
        endpoint_group = unit.new_endpoint_group_ref(
            filters={'interface': 'public'})
        PROVIDERS.catalog_api.create_endpoint_group(
            endpoint_group['id'], endpoint_group
        )

        with self.test_client() as c:
            c.get('/v3/OS-EP-FILTER/endpoint_groups', headers=self.headers,
                  expected_status_code=http.client.FORBIDDEN)
コード例 #3
0
 def test_user_add_endpoint_group_to_project(self):
     project = PROVIDERS.resource_api.create_project(
         uuid.uuid4().hex,
         unit.new_project_ref(domain_id=CONF.identity.default_domain_id))
     endpoint_group = unit.new_endpoint_group_ref(
         filters={'interface': 'public'})
     endpoint_group = PROVIDERS.catalog_api.create_endpoint_group(
         endpoint_group['id'], endpoint_group)
     with self.test_client() as c:
         c.put('/v3/OS-EP-FILTER/endpoint_groups/%s/projects/%s' %
               (endpoint_group['id'], project['id']),
               headers=self.headers)
コード例 #4
0
    def test_user_can_update_endpoint_group(self):
        endpoint_group = unit.new_endpoint_group_ref(
            filters={'interface': 'public'})
        endpoint_group = PROVIDERS.catalog_api.create_endpoint_group(
            endpoint_group['id'], endpoint_group)

        update = {'endpoint_group': {'filters': {'interface': 'internal'}}}

        with self.test_client() as c:
            c.patch('/v3/OS-EP-FILTER/endpoint_groups/%s' %
                    endpoint_group['id'],
                    json=update,
                    headers=self.headers)
コード例 #5
0
 def test_cannot_remove_endpoint_group_from_project(self):
     project = PROVIDERS.resource_api.create_project(
         uuid.uuid4().hex,
         unit.new_project_ref(domain_id=CONF.identity.default_domain_id))
     endpoint_group = unit.new_endpoint_group_ref(
         filters={'interface': 'public'})
     endpoint_group = PROVIDERS.catalog_api.create_endpoint_group(
         endpoint_group['id'], endpoint_group)
     with self.test_client() as c:
         c.delete('/v3/OS-EP-FILTER/endpoint_groups/%s/projects/%s' %
                  (endpoint_group['id'], project['id']),
                  headers=self.headers,
                  expected_status_code=http_client.FORBIDDEN)
コード例 #6
0
    def test_user_can_list_endpoint_groups(self):
        endpoint_group = unit.new_endpoint_group_ref(
            filters={'interface': 'public'})
        endpoint_group = PROVIDERS.catalog_api.create_endpoint_group(
            endpoint_group['id'], endpoint_group)

        with self.test_client() as c:
            r = c.get('/v3/OS-EP-FILTER/endpoint_groups', headers=self.headers)
            endpoint_groups = []
            for endpoint_group in r.json['endpoint_groups']:
                endpoint_groups.append(endpoint_group['id'])

            self.assertIn(endpoint_group['id'], endpoint_groups)
コード例 #7
0
 def test_user_cannot_list_endpoint_groups_with_their_projects(self):
     project = PROVIDERS.resource_api.create_project(
         uuid.uuid4().hex,
         unit.new_project_ref(domain_id=CONF.identity.default_domain_id))
     endpoint_group = unit.new_endpoint_group_ref(
         filters={'interface': 'public'})
     endpoint_group = PROVIDERS.catalog_api.create_endpoint_group(
         endpoint_group['id'], endpoint_group)
     PROVIDERS.catalog_api.add_endpoint_group_to_project(
         endpoint_group['id'], project['id'])
     with self.test_client() as c:
         c.get('/v3/OS-EP-FILTER/projects/%s/endpoint_groups' %
               project['id'],
               headers=self.headers,
               expected_status_code=http_client.FORBIDDEN)
コード例 #8
0
 def test_user_cannot_list_endpoints_associated_with_endpoint_groups(self):
     service = PROVIDERS.catalog_api.create_service(uuid.uuid4().hex,
                                                    unit.new_service_ref())
     endpoint = unit.new_endpoint_ref(service['id'], region_id=None)
     endpoint = PROVIDERS.catalog_api.create_endpoint(
         endpoint['id'], endpoint)
     endpoint_group = unit.new_endpoint_group_ref(
         filters={'interface': 'public'})
     endpoint_group = PROVIDERS.catalog_api.create_endpoint_group(
         endpoint_group['id'], endpoint_group)
     with self.test_client() as c:
         c.get('/v3/OS-EP-FILTER/endpoint_groups/%s/endpoints' %
               endpoint_group['id'],
               headers=self.headers,
               expected_status_code=http_client.FORBIDDEN)
コード例 #9
0
 def test_user_can_list_endpoint_groups_with_their_projects(self):
     project = PROVIDERS.resource_api.create_project(
         uuid.uuid4().hex,
         unit.new_project_ref(domain_id=CONF.identity.default_domain_id))
     endpoint_group = unit.new_endpoint_group_ref(
         filters={'interface': 'public'})
     endpoint_group = PROVIDERS.catalog_api.create_endpoint_group(
         endpoint_group['id'], endpoint_group)
     PROVIDERS.catalog_api.add_endpoint_group_to_project(
         endpoint_group['id'], project['id'])
     with self.test_client() as c:
         r = c.get('/v3/OS-EP-FILTER/projects/%s/endpoint_groups' %
                   project['id'],
                   headers=self.headers)
         endpoint_groups = []
         for endpoint_group in r.json['endpoint_groups']:
             endpoint_groups.append(endpoint_group['id'])
コード例 #10
0
 def test_user_can_list_endpoints_associated_with_endpoint_groups(self):
     service = PROVIDERS.catalog_api.create_service(uuid.uuid4().hex,
                                                    unit.new_service_ref())
     endpoint = unit.new_endpoint_ref(service['id'], region_id=None)
     endpoint = PROVIDERS.catalog_api.create_endpoint(
         endpoint['id'], endpoint)
     endpoint_group = unit.new_endpoint_group_ref(
         filters={'interface': 'public'})
     endpoint_group = PROVIDERS.catalog_api.create_endpoint_group(
         endpoint_group['id'], endpoint_group)
     with self.test_client() as c:
         r = c.get('/v3/OS-EP-FILTER/endpoint_groups/%s/endpoints' %
                   endpoint_group['id'],
                   headers=self.headers)
         endpoints = []
         for endpoint in r.json['endpoints']:
             endpoints.append(endpoint['id'])
         self.assertIn(endpoint['id'], endpoints)