Example #1
0
    def update_service(self,
                       service_id,
                       name=None,
                       type_=None,
                       description=None,
                       requestslib_kwargs=None):
        """
        @summary: Updates a service given the provided parameters
         Maps to /services
        @param service_id: The ID of an existing service.
        @type service_id: String
        @param name: The name for the service
        @type name: String
        @param description: The description of the service
        @type description: String
        @param type_: The type of the service
        @type type_: String
        @return: response
        @rtype: Response
        """

        url = '{0}/{1}/services/{2}'.format(self.base_url, _admin_extensions,
                                            service_id)
        service_request_object = Service(id_=service_id,
                                         name=name,
                                         type_=type_,
                                         description=description)

        response = self.request('PUT',
                                url,
                                response_entity_type=Service,
                                request_entity=service_request_object,
                                requestslib_kwargs=requestslib_kwargs)

        return response
Example #2
0
 def setup_class(cls):
     cls.name = "keystone-test"
     cls.type = "identity-test"
     cls.description = "Keystone Identity Service Test"
     cls.admin_ext = "OS-KSADM"
     cls.service_dict = {
         "name": cls.name,
         "type": cls.type,
         "description": cls.description
     }
     cls.expected_service = Service(name=cls.name,
                                    type_=cls.type,
                                    description=cls.description)
     cls.json_dict = json.dumps(
         {"{0}:service".format(cls.admin_ext): cls.service_dict})
     cls.expected_services = Services(services=[cls.expected_service])
     cls.service_dict_list = [cls.service_dict]
     cls.services_json_dict = json.dumps(
         {"{0}:services".format(cls.admin_ext): cls.service_dict_list})
Example #3
0
 def test_json_to_obj(self):
     assert self.expected_service == Service._json_to_obj(self.json_dict)
     assert self.expected_services == Services._json_to_obj(
         self.services_json_dict)
Example #4
0
 def test_dict_to_obj(self):
     assert self.expected_service == Service._dict_to_obj(self.service_dict)
Example #5
0
 def test_json_to_obj(self):
     assert self.expected_service == Service._json_to_obj(self.json_dict)
     assert self.expected_services == Services._json_to_obj(
         self.services_json_dict)
Example #6
0
 def test_dict_to_obj(self):
     assert self.expected_service == Service._dict_to_obj(self.service_dict)