diff --git a/lib/galaxy_test/base/populators.py b/lib/galaxy_test/base/populators.py index 075222d1d638..bf13ded7da8f 100644 --- a/lib/galaxy_test/base/populators.py +++ b/lib/galaxy_test/base/populators.py @@ -547,6 +547,16 @@ def create_role(self, user_ids, description=None): assert role_response.status_code == 200 return role_response.json()[0] + def create_quota(self, quota_payload): + quota_response = self.galaxy_interactor.post("quotas", data=quota_payload, admin=True) + quota_response.raise_for_status() + return quota_response.json() + + def get_quotas(self): + quota_response = self.galaxy_interactor.get("quotas", admin=True) + quota_response.raise_for_status() + return quota_response.json() + def make_private(self, history_id, dataset_id): role_id = self.user_private_role_id() # Give manage permission to the user. diff --git a/test/integration/test_quota.py b/test/integration/test_quota.py new file mode 100644 index 000000000000..0dd39c720eaf --- /dev/null +++ b/test/integration/test_quota.py @@ -0,0 +1,32 @@ +from galaxy_test.base.populators import ( + DatasetPopulator, +) +from galaxy_test.driver import integration_util + + +class QuotaIntegrationTestCase(integration_util.IntegrationTestCase): + require_admin_user = True + + @classmethod + def handle_galaxy_config_kwds(cls, config): + config["enable_quotas"] = True + + def setUp(self): + super().setUp() + self.dataset_populator = DatasetPopulator(self.galaxy_interactor) + + def test_quota_crud(self): + quotas = self.dataset_populator.get_quotas() + assert len(quotas) == 0 + + payload = { + 'name': 'defaultquota1', + 'description': 'first default quota', + 'amount': '100MB', + 'operation': '=', + 'default': 'registered', + } + self.dataset_populator.create_quota(payload) + + quotas = self.dataset_populator.get_quotas() + assert len(quotas) == 1