Skip to content

Commit

Permalink
API test case for quota.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmchilton committed Sep 30, 2020
1 parent fece821 commit 5e55693
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/galaxy_test/base/populators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
32 changes: 32 additions & 0 deletions test/integration/test_quota.py
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 5e55693

Please sign in to comment.