comparison env/lib/python3.7/site-packages/bioblend/_tests/TestGalaxyQuotas.py @ 0:26e78fe6e8c4 draft

"planemo upload commit c699937486c35866861690329de38ec1a5d9f783"
author shellac
date Sat, 02 May 2020 07:14:21 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:26e78fe6e8c4
1 import uuid
2
3 from . import GalaxyTestBase
4
5
6 class TestGalaxyQuotas(GalaxyTestBase.GalaxyTestBase):
7
8 def setUp(self):
9 super(TestGalaxyQuotas, self).setUp()
10 # Quota names must be unique, and they're impossible to delete
11 # without accessing the database.
12 self.quota_name = 'BioBlend-Test-Quota-%s' % uuid.uuid4().hex
13 self.quota = self.gi.quotas.create_quota(
14 self.quota_name, 'testing', '100 GB', '=',
15 default='registered'
16 )
17
18 def tearDown(self):
19 self.gi.quotas.update_quota(self.quota['id'], default='registered')
20 self.gi.quotas.update_quota(self.quota['id'], default='no')
21 self.gi.quotas.delete_quota(self.quota['id'])
22
23 def test_create_quota(self):
24 quota = self.gi.quotas.show_quota(self.quota['id'])
25 self.assertEqual(quota['name'], self.quota_name)
26 self.assertEqual(quota['bytes'], 107374182400)
27 self.assertEqual(quota['operation'], '=')
28 self.assertEqual(quota['description'], 'testing')
29
30 def test_get_quotas(self):
31 quotas = self.gi.quotas.get_quotas()
32 self.assertIn(self.quota['id'], [quota['id'] for quota in quotas])
33
34 def test_update_quota(self):
35 response = self.gi.quotas.update_quota(
36 self.quota['id'], name=self.quota_name + '-new',
37 description='asdf', default='registered', operation='-',
38 amount='.01 TB'
39 )
40 self.assertIn("""Quota '%s' has been renamed to '%s-new'""" % (self.quota_name, self.quota_name), response)
41
42 quota = self.gi.quotas.show_quota(self.quota['id'])
43 self.assertEqual(quota['name'], self.quota_name + '-new')
44 self.assertEqual(quota['bytes'], 10995116277)
45 self.assertEqual(quota['operation'], '-')
46 self.assertEqual(quota['description'], 'asdf')
47
48 def test_delete_undelete_quota(self):
49 self.gi.quotas.update_quota(
50 self.quota['id'], default='no'
51 )
52 response = self.gi.quotas.delete_quota(self.quota['id'])
53 self.assertEqual(response, 'Deleted 1 quotas: ' + self.quota_name)
54 response = self.gi.quotas.undelete_quota(self.quota['id'])
55 self.assertEqual(response, 'Undeleted 1 quotas: ' + self.quota_name)