Exemple #1
0
 def test_update_endpoint(self):
     # Creating an endpoint so as to check update endpoint
     # with new values
     region1 = data_utils.rand_name("region")
     url1 = data_utils.rand_url()
     interface1 = "public"
     endpoint_for_update = self.client.create_endpoint(
         self.service_id, interface1, url1, region=region1, enabled=True
     )
     self.addCleanup(self.client.delete_endpoint, endpoint_for_update["id"])
     # Creating service so as update endpoint with new service ID
     s_name = data_utils.rand_name("service")
     s_type = data_utils.rand_name("type")
     s_description = data_utils.rand_name("description")
     service2 = self.service_client.create_service(s_name, s_type, description=s_description)
     service2 = service2["service"]
     self.service_ids.append(service2["id"])
     # Updating endpoint with new values
     region2 = data_utils.rand_name("region")
     url2 = data_utils.rand_url()
     interface2 = "internal"
     endpoint = self.client.update_endpoint(
         endpoint_for_update["id"],
         service_id=service2["id"],
         interface=interface2,
         url=url2,
         region=region2,
         enabled=False,
     )
     # Asserting if the attributes of endpoint are updated
     self.assertEqual(service2["id"], endpoint["service_id"])
     self.assertEqual(interface2, endpoint["interface"])
     self.assertEqual(url2, endpoint["url"])
     self.assertEqual(region2, endpoint["region"])
     self.assertEqual(False, endpoint["enabled"])
Exemple #2
0
 def test_update_endpoint(self):
     # Creating an endpoint so as to check update endpoint
     # with new values
     region1 = data_utils.rand_name('region')
     url1 = data_utils.rand_url()
     interface1 = 'public'
     resp, endpoint_for_update =\
         self.client.create_endpoint(self.service_id, interface1,
                                     url1, region=region1,
                                     enabled=True)
     self.addCleanup(self.client.delete_endpoint, endpoint_for_update['id'])
     # Creating service so as update endpoint with new service ID
     s_name = data_utils.rand_name('service-')
     s_type = data_utils.rand_name('type--')
     s_description = data_utils.rand_name('description-')
     _, service2 =\
         self.service_client.create_service(s_name, s_type,
                                            description=s_description)
     self.service_ids.append(service2['id'])
     # Updating endpoint with new values
     region2 = data_utils.rand_name('region')
     url2 = data_utils.rand_url()
     interface2 = 'internal'
     _, endpoint = \
         self.client.update_endpoint(endpoint_for_update['id'],
                                     service_id=service2['id'],
                                     interface=interface2, url=url2,
                                     region=region2, enabled=False)
     # Asserting if the attributes of endpoint are updated
     self.assertEqual(service2['id'], endpoint['service_id'])
     self.assertEqual(interface2, endpoint['interface'])
     self.assertEqual(url2, endpoint['url'])
     self.assertEqual(region2, endpoint['region'])
     self.assertEqual('false', str(endpoint['enabled']).lower())
Exemple #3
0
 def test_update_endpoint(self):
     # Creating an endpoint so as to check update endpoint
     # with new values
     region1 = data_utils.rand_name('region')
     url1 = data_utils.rand_url()
     interface1 = 'public'
     endpoint_for_update =\
         self.client.create_endpoint(self.service_id, interface1,
                                     url1, region=region1,
                                     enabled=True)
     self.addCleanup(self.client.delete_endpoint, endpoint_for_update['id'])
     # Creating service so as update endpoint with new service ID
     s_name = data_utils.rand_name('service-')
     s_type = data_utils.rand_name('type--')
     s_description = data_utils.rand_name('description-')
     service2 =\
         self.service_client.create_service(s_name, s_type,
                                            description=s_description)
     self.service_ids.append(service2['id'])
     # Updating endpoint with new values
     region2 = data_utils.rand_name('region')
     url2 = data_utils.rand_url()
     interface2 = 'internal'
     endpoint = \
         self.client.update_endpoint(endpoint_for_update['id'],
                                     service_id=service2['id'],
                                     interface=interface2, url=url2,
                                     region=region2, enabled=False)
     # Asserting if the attributes of endpoint are updated
     self.assertEqual(service2['id'], endpoint['service_id'])
     self.assertEqual(interface2, endpoint['interface'])
     self.assertEqual(url2, endpoint['url'])
     self.assertEqual(region2, endpoint['region'])
     self.assertEqual('false', str(endpoint['enabled']).lower())
 def resource_setup(cls):
     super(EndPointsTestJSON, cls).resource_setup()
     cls.service_ids = list()
     s_name = data_utils.rand_name('service')
     s_type = data_utils.rand_name('type')
     s_description = data_utils.rand_name('description')
     cls.service_data = cls.services_client.create_service(
         name=s_name, type=s_type,
         description=s_description)['OS-KSADM:service']
     cls.service_id = cls.service_data['id']
     cls.service_ids.append(cls.service_id)
     # Create endpoints so as to use for LIST and GET test cases
     cls.setup_endpoints = list()
     for i in range(2):
         region = data_utils.rand_name('region')
         url = data_utils.rand_url()
         endpoint = cls.endpoints_client.create_endpoint(
             service_id=cls.service_id,
             region=region,
             publicurl=url,
             adminurl=url,
             internalurl=url)['endpoint']
         # list_endpoints() will return 'enabled' field
         endpoint['enabled'] = True
         cls.setup_endpoints.append(endpoint)
Exemple #5
0
 def resource_setup(cls):
     super(EndPointsTestJSON, cls).resource_setup()
     cls.identity_client = cls.client
     cls.client = cls.endpoints_client
     cls.service_ids = list()
     s_name = data_utils.rand_name('service-')
     s_type = data_utils.rand_name('type--')
     s_description = data_utils.rand_name('description-')
     cls.service_data =\
         cls.service_client.create_service(s_name, s_type,
                                           description=s_description)
     cls.service_id = cls.service_data['id']
     cls.service_ids.append(cls.service_id)
     # Create endpoints so as to use for LIST and GET test cases
     cls.setup_endpoints = list()
     for i in range(2):
         region = data_utils.rand_name('region')
         url = data_utils.rand_url()
         interface = 'public'
         endpoint = cls.client.create_endpoint(cls.service_id,
                                               interface,
                                               url,
                                               region=region,
                                               enabled=True)
         cls.setup_endpoints.append(endpoint)
Exemple #6
0
 def resource_setup(cls):
     super(EndPointsTestJSON, cls).resource_setup()
     cls.service_ids = list()
     s_name = data_utils.rand_name('service')
     s_type = data_utils.rand_name('type')
     s_description = data_utils.rand_name('description')
     cls.service_data = cls.services_client.create_service(
         name=s_name, type=s_type,
         description=s_description)['OS-KSADM:service']
     cls.service_id = cls.service_data['id']
     cls.service_ids.append(cls.service_id)
     # Create endpoints so as to use for LIST and GET test cases
     cls.setup_endpoints = list()
     for i in range(2):
         region = data_utils.rand_name('region')
         url = data_utils.rand_url()
         endpoint = cls.endpoints_client.create_endpoint(
             service_id=cls.service_id,
             region=region,
             publicurl=url,
             adminurl=url,
             internalurl=url)['endpoint']
         # list_endpoints() will return 'enabled' field
         endpoint['enabled'] = True
         cls.setup_endpoints.append(endpoint)
Exemple #7
0
 def test_create_with_enabled_True(self):
     # Enabled should be a boolean, not a string like 'True'
     interface = 'public'
     url = data_utils.rand_url()
     region = data_utils.rand_name('region')
     self.assertRaises(lib_exc.BadRequest, self.client.create_endpoint,
                       service_id=self.service_id, interface=interface,
                       url=url, region=region, enabled='True')
 def test_create_with_enabled_False(self):
     # Enabled should be a boolean, not a string like 'False'
     interface = 'public'
     url = data_utils.rand_url()
     region = data_utils.rand_name('region')
     self.assertRaises(exceptions.BadRequest, self.client.create_endpoint,
                       self.service_id, interface, url, region=region,
                       force_enabled='False')
 def test_create_with_enabled_True(self):
     # Enabled should be a boolean, not a string like 'True'
     interface = 'public'
     url = data_utils.rand_url()
     region = data_utils.rand_name('region')
     self.assertRaises(lib_exc.BadRequest, self.client.create_endpoint,
                       self.service_id, interface, url, region=region,
                       force_enabled='True')
    def _assert_update_raises_bad_request(self, enabled):

        # Create an endpoint
        region1 = data_utils.rand_name('region')
        url1 = data_utils.rand_url()
        interface1 = 'public'
        resp, endpoint_for_update = (
            self.client.create_endpoint(self.service_id, interface1,
                                        url1, region=region1, enabled=True))
        self.addCleanup(self.client.delete_endpoint, endpoint_for_update['id'])

        self.assertRaises(exceptions.BadRequest, self.client.update_endpoint,
                          endpoint_for_update['id'], force_enabled=enabled)
    def _assert_update_raises_bad_request(self, enabled):

        # Create an endpoint
        region1 = data_utils.rand_name('region')
        url1 = data_utils.rand_url()
        interface1 = 'public'
        endpoint_for_update = (
            self.client.create_endpoint(self.service_id, interface1,
                                        url1, region=region1, enabled=True))
        self.addCleanup(self.client.delete_endpoint, endpoint_for_update['id'])

        self.assertRaises(exceptions.BadRequest, self.client.update_endpoint,
                          endpoint_for_update['id'], force_enabled=enabled)
Exemple #12
0
 def resource_setup(cls):
     super(EndPointsTestJSON, cls).resource_setup()
     cls.service_ids = list()
     s_name = data_utils.rand_name("service")
     s_type = data_utils.rand_name("type")
     s_description = data_utils.rand_name("description")
     cls.service_data = cls.service_client.create_service(s_name, s_type, description=s_description)
     cls.service_data = cls.service_data["service"]
     cls.service_id = cls.service_data["id"]
     cls.service_ids.append(cls.service_id)
     # Create endpoints so as to use for LIST and GET test cases
     cls.setup_endpoints = list()
     for i in range(2):
         region = data_utils.rand_name("region")
         url = data_utils.rand_url()
         interface = "public"
         endpoint = cls.client.create_endpoint(cls.service_id, interface, url, region=region, enabled=True)
         cls.setup_endpoints.append(endpoint)
Exemple #13
0
 def test_create_list_delete_endpoint(self):
     region = data_utils.rand_name("region")
     url = data_utils.rand_url()
     interface = "public"
     endpoint = self.client.create_endpoint(self.service_id, interface, url, region=region, enabled=True)
     # Asserting Create Endpoint response body
     self.assertIn("id", endpoint)
     self.assertEqual(region, endpoint["region"])
     self.assertEqual(url, endpoint["url"])
     # Checking if created endpoint is present in the list of endpoints
     fetched_endpoints = self.client.list_endpoints()
     fetched_endpoints_id = [e["id"] for e in fetched_endpoints]
     self.assertIn(endpoint["id"], fetched_endpoints_id)
     # Deleting the endpoint created in this method
     self.client.delete_endpoint(endpoint["id"])
     # Checking whether endpoint is deleted successfully
     fetched_endpoints = self.client.list_endpoints()
     fetched_endpoints_id = [e["id"] for e in fetched_endpoints]
     self.assertNotIn(endpoint["id"], fetched_endpoints_id)
 def test_create_list_delete_endpoint(self):
     region = data_utils.rand_name('region')
     url = data_utils.rand_url()
     interface = 'public'
     endpoint = (self.client.create_endpoint(self.service_id, interface,
                 url, region=region, enabled=True)['endpoint'])
     # Asserting Create Endpoint response body
     self.assertIn('id', endpoint)
     self.assertEqual(region, endpoint['region'])
     self.assertEqual(url, endpoint['url'])
     # Checking if created endpoint is present in the list of endpoints
     fetched_endpoints = self.client.list_endpoints()['endpoints']
     fetched_endpoints_id = [e['id'] for e in fetched_endpoints]
     self.assertIn(endpoint['id'], fetched_endpoints_id)
     # Deleting the endpoint created in this method
     self.client.delete_endpoint(endpoint['id'])
     # Checking whether endpoint is deleted successfully
     fetched_endpoints = self.client.list_endpoints()['endpoints']
     fetched_endpoints_id = [e['id'] for e in fetched_endpoints]
     self.assertNotIn(endpoint['id'], fetched_endpoints_id)
 def resource_setup(cls):
     super(EndPointsTestJSON, cls).resource_setup()
     cls.service_ids = list()
     s_name = data_utils.rand_name('service')
     s_type = data_utils.rand_name('type')
     s_description = data_utils.rand_name('description')
     cls.service_data =\
         cls.service_client.create_service(s_name, s_type,
                                           description=s_description)
     cls.service_data = cls.service_data['service']
     cls.service_id = cls.service_data['id']
     cls.service_ids.append(cls.service_id)
     # Create endpoints so as to use for LIST and GET test cases
     cls.setup_endpoints = list()
     for i in range(2):
         region = data_utils.rand_name('region')
         url = data_utils.rand_url()
         interface = 'public'
         endpoint = (cls.client.create_endpoint(cls.service_id, interface,
                     url, region=region, enabled=True))['endpoint']
         cls.setup_endpoints.append(endpoint)
Exemple #16
0
 def test_create_list_delete_endpoint(self):
     region = data_utils.rand_name('region')
     url = data_utils.rand_url()
     interface = 'public'
     endpoint =\
         self.client.create_endpoint(self.service_id, interface, url,
                                     region=region, enabled=True)
     # Asserting Create Endpoint response body
     self.assertIn('id', endpoint)
     self.assertEqual(region, endpoint['region'])
     self.assertEqual(url, endpoint['url'])
     # Checking if created endpoint is present in the list of endpoints
     fetched_endpoints = self.client.list_endpoints()
     fetched_endpoints_id = [e['id'] for e in fetched_endpoints]
     self.assertIn(endpoint['id'], fetched_endpoints_id)
     # Deleting the endpoint created in this method
     self.client.delete_endpoint(endpoint['id'])
     # Checking whether endpoint is deleted successfully
     fetched_endpoints = self.client.list_endpoints()
     fetched_endpoints_id = [e['id'] for e in fetched_endpoints]
     self.assertNotIn(endpoint['id'], fetched_endpoints_id)
 def setUpClass(cls):
     super(EndPointsTestJSON, cls).setUpClass()
     cls.identity_client = cls.client
     cls.client = cls.endpoints_client
     cls.service_ids = list()
     s_name = data_utils.rand_name('service-')
     s_type = data_utils.rand_name('type--')
     s_description = data_utils.rand_name('description-')
     _, cls.service_data =\
         cls.service_client.create_service(s_name, s_type,
                                           description=s_description)
     cls.service_id = cls.service_data['id']
     cls.service_ids.append(cls.service_id)
     # Create endpoints so as to use for LIST and GET test cases
     cls.setup_endpoints = list()
     for i in range(2):
         region = data_utils.rand_name('region')
         url = data_utils.rand_url()
         interface = 'public'
         resp, endpoint = cls.client.create_endpoint(
             cls.service_id, interface, url, region=region, enabled=True)
         cls.setup_endpoints.append(endpoint)
Exemple #18
0
    def test_create_list_show_delete_endpoint(self):
        region = data_utils.rand_name('region')
        url = data_utils.rand_url()
        interface = 'public'
        endpoint = self.client.create_endpoint(service_id=self.service_id,
                                               interface=interface,
                                               url=url,
                                               region=region,
                                               enabled=True)['endpoint']

        self.setup_endpoints.append(endpoint)
        # Asserting Create Endpoint response body
        self.assertIn('id', endpoint)
        self.assertEqual(region, endpoint['region'])
        self.assertEqual(url, endpoint['url'])

        # Checking if created endpoint is present in the list of endpoints
        fetched_endpoints = self.client.list_endpoints()['endpoints']
        fetched_endpoints_id = [e['id'] for e in fetched_endpoints]
        self.assertIn(endpoint['id'], fetched_endpoints_id)

        # Show endpoint
        fetched_endpoint = (self.client.show_endpoint(
            endpoint['id'])['endpoint'])
        # Asserting if the attributes of endpoint are the same
        self.assertEqual(self.service_id, fetched_endpoint['service_id'])
        self.assertEqual(interface, fetched_endpoint['interface'])
        self.assertEqual(url, fetched_endpoint['url'])
        self.assertEqual(region, fetched_endpoint['region'])
        self.assertEqual(True, fetched_endpoint['enabled'])

        # Deleting the endpoint created in this method
        self.client.delete_endpoint(endpoint['id'])
        self.setup_endpoints.remove(endpoint)

        # Checking whether endpoint is deleted successfully
        fetched_endpoints = self.client.list_endpoints()['endpoints']
        fetched_endpoints_id = [e['id'] for e in fetched_endpoints]
        self.assertNotIn(endpoint['id'], fetched_endpoints_id)
Exemple #19
0
 def test_create_list_delete_endpoint(self):
     region = data_utils.rand_name('region')
     url = data_utils.rand_url()
     endpoint = self.endpoints_client.create_endpoint(
         service_id=self.service_id,
         region=region,
         publicurl=url,
         adminurl=url,
         internalurl=url)['endpoint']
     # Asserting Create Endpoint response body
     self.assertIn('id', endpoint)
     self.assertEqual(region, endpoint['region'])
     self.assertEqual(url, endpoint['publicurl'])
     # Checking if created endpoint is present in the list of endpoints
     fetched_endpoints = self.endpoints_client.list_endpoints()['endpoints']
     fetched_endpoints_id = [e['id'] for e in fetched_endpoints]
     self.assertIn(endpoint['id'], fetched_endpoints_id)
     # Deleting the endpoint created in this method
     self.endpoints_client.delete_endpoint(endpoint['id'])
     # Checking whether endpoint is deleted successfully
     fetched_endpoints = self.endpoints_client.list_endpoints()['endpoints']
     fetched_endpoints_id = [e['id'] for e in fetched_endpoints]
     self.assertNotIn(endpoint['id'], fetched_endpoints_id)