Mercurial > repos > shellac > guppy_basecaller
comparison env/lib/python3.7/site-packages/bioblend/_tests/TestGalaxyGroups.py @ 5:9b1c78e6ba9c draft default tip
"planemo upload commit 6c0a8142489327ece472c84e558c47da711a9142"
author | shellac |
---|---|
date | Mon, 01 Jun 2020 08:59:25 -0400 |
parents | 79f47841a781 |
children |
comparison
equal
deleted
inserted
replaced
4:79f47841a781 | 5:9b1c78e6ba9c |
---|---|
1 """ | |
2 WARNING: only admins can operate on groups! | |
3 """ | |
4 import uuid | |
5 | |
6 from . import GalaxyTestBase | |
7 | |
8 | |
9 class TestGalaxyGroups(GalaxyTestBase.GalaxyTestBase): | |
10 | |
11 def setUp(self): | |
12 super(TestGalaxyGroups, self).setUp() | |
13 self.name = 'test_%s' % uuid.uuid4().hex | |
14 self.group = self.gi.groups.create_group(self.name)[0] | |
15 | |
16 def tearDown(self): | |
17 # As of 2015/04/13, deleting a group is not possible through the API | |
18 pass | |
19 | |
20 def test_create_group(self): | |
21 self.assertEqual(self.group['name'], self.name) | |
22 self.assertIsNotNone(self.group['id']) | |
23 | |
24 def test_get_groups(self): | |
25 groups = self.gi.groups.get_groups() | |
26 for group in groups: | |
27 self.assertIsNotNone(group['id']) | |
28 self.assertIsNotNone(group['name']) | |
29 | |
30 def test_show_group(self): | |
31 group_data = self.gi.groups.show_group(self.group['id']) | |
32 self.assertEqual(self.group['id'], group_data['id']) | |
33 self.assertEqual(self.group['name'], group_data['name']) | |
34 | |
35 def test_get_group_users(self): | |
36 group_users = self.gi.groups.get_group_users(self.group['id']) | |
37 self.assertEqual(group_users, []) | |
38 | |
39 def test_get_group_roles(self): | |
40 group_roles = self.gi.groups.get_group_roles(self.group['id']) | |
41 self.assertEqual(group_roles, []) | |
42 | |
43 def test_update_group(self): | |
44 new_name = 'test_%s' % uuid.uuid4().hex | |
45 new_users = [self.gi.users.get_current_user()['id']] | |
46 self.gi.groups.update_group(self.group['id'], new_name, user_ids=new_users) | |
47 updated_group = self.gi.groups.show_group(self.group['id']) | |
48 self.assertEqual(self.group['id'], updated_group['id']) | |
49 self.assertEqual(updated_group['name'], new_name) | |
50 updated_group_users = [_['id'] for _ in self.gi.groups.get_group_users(self.group['id'])] | |
51 self.assertEqual(set(updated_group_users), set(new_users)) | |
52 updated_group_roles = [_['id'] for _ in self.gi.groups.get_group_roles(self.group['id'])] | |
53 self.assertEqual(set(updated_group_roles), set()) | |
54 | |
55 def test_add_delete_group_user(self): | |
56 new_user = self.gi.users.get_current_user()['id'] | |
57 ret = self.gi.groups.add_group_user(self.group['id'], new_user) | |
58 self.assertEqual(ret['id'], new_user) | |
59 updated_group_users = [_['id'] for _ in self.gi.groups.get_group_users(self.group['id'])] | |
60 self.assertIn(new_user, updated_group_users) | |
61 self.gi.groups.delete_group_user(self.group['id'], new_user) | |
62 updated_group_users = [_['id'] for _ in self.gi.groups.get_group_users(self.group['id'])] | |
63 self.assertNotIn(new_user, updated_group_users) |