def test_serialize_host_update_request_to_xml(self): quota_obj = UpdateQuotaRequest(security_groups=45, id='fake_tenant') xml_serialized_quota = quota_obj.serialize("xml") expected_xml = ('<?xml version=\'1.0\' encoding=\'UTF-8\'?>' '<quota_set id="fake_tenant">' '<security_groups>45</security_groups>' '</quota_set>') self.assertEqual(xml_serialized_quota, expected_xml)
def update_quota(self, tenant_id, **request_args): """ @summary: Returns updated quota for tenant_id @param: tenant_id: id of tenant @type: String @param: request_args: key-value pair of attibutes have to be updated. @return: resp @rtype: Request.responses """ update_quota_request_object = UpdateQuotaRequest(**request_args) url = "{url}/os-quota-sets/{tenant_id}".format(url=self.url, tenant_id=tenant_id) quota_response = self.request( 'PUT', url, response_entity_type=Quota, request_entity=update_quota_request_object) return quota_response
def test_serialize_host_update_request_to_json(self): quota_obj = UpdateQuotaRequest(security_groups=45) json_serialized_quota = quota_obj.serialize("json") expected_json = '{"quota_set": {"security_groups": 45}}' self.assertEqual(json_serialized_quota, expected_json)