Пример #1
0
    def test_set_project_quotas(self):
        """Get project quota information"""

        request_model = quota_models.ProjectQuotaRequestModel(
            **get_set_project_quotas_request())
        resp = self.behaviors.set_project_quotas(self.project_id,
                                                 request_model)
        self.assertEqual(200, resp.status_code)
 def set_quotas(self, resource, quota):
     """Utility function to set resource quotas"""
     self.quota_data["project_quotas"][resource] = quota
     request_model = quota_models.ProjectQuotaRequestModel(
         **self.quota_data)
     resp = self.quota_behaviors.set_project_quotas(self.project_id,
                                                    request_model,
                                                    user_name=service_admin)
     self.assertEqual(204, resp.status_code)
Пример #3
0
    def test_delete_project_quotas(self):
        """Delete project quota information"""
        request_model = quota_models.ProjectQuotaRequestModel(
            **get_set_project_quotas_request())
        resp = self.behaviors.set_project_quotas('55555',
                                                 request_model,
                                                 user_name=service_admin)
        self.assertEqual(204, resp.status_code)

        resp = self.behaviors.delete_project_quotas('55555',
                                                    user_name=service_admin)
        self.assertEqual(204, resp.status_code)
Пример #4
0
    def test_get_project_quota_list_one(self):
        """Get list of all project quotas, when there is one"""

        request_model = quota_models.ProjectQuotaRequestModel(
            **get_set_project_quotas_request())
        resp = self.behaviors.set_project_quotas('11111',
                                                 request_model,
                                                 user_name=service_admin)
        self.assertEqual(204, resp.status_code)

        resp, project_quotas_list, _, _ =\
            self.behaviors.get_project_quotas_list(user_name=service_admin)

        self.assertEqual(200, resp.status_code)
        self.assertEqual(1, len(project_quotas_list))
Пример #5
0
    def test_rbac_set_project_quotas(self, user, admin, expected_return):
        """Test RBAC for set project quotas

        Issue a set project quotas and verify that that the correct
        http return code comes back for the specified user.

        :param user: the user who will attempt to do the set
        :param admin: the admin of the group owning quotas
        :param expected_return: the expected http return code
        """
        request_model = quota_models.ProjectQuotaRequestModel(
            **get_set_project_quotas_request())
        project_id = str(uuid.uuid4())
        resp = self.behaviors.set_project_quotas(project_id,
                                                 request_model,
                                                 user_name=user)
        self.assertEqual(expected_return, resp.status_code)
Пример #6
0
    def test_get_project_quotas_by_project_id(self):
        """Get project quota information for specific project"""

        request_model = quota_models.ProjectQuotaRequestModel(
            **get_set_project_quotas_request())
        resp = self.behaviors.set_project_quotas('44444',
                                                 request_model,
                                                 user_name=service_admin)
        self.assertEqual(204, resp.status_code)

        resp = self.behaviors.get_project_quotas('44444',
                                                 user_name=service_admin)

        self.assertEqual(200, resp.status_code)
        self.assertEqual(50, resp.model.project_quotas.secrets)
        self.assertEqual(10, resp.model.project_quotas.orders)
        self.assertEqual(20, resp.model.project_quotas.containers)
        self.assertIsNone(resp.model.project_quotas.consumers)
        self.assertIsNone(resp.model.project_quotas.cas)
Пример #7
0
 def create_model(self):
     request_model = quota_models.ProjectQuotaRequestModel(
         **get_set_project_quotas_request())
     return request_model