Mercurial > repos > shellac > guppy_basecaller
comparison env/lib/python3.7/site-packages/bioblend/_tests/TestGalaxyUsers.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 Tests the functionality of the Blend CloudMan API. These tests require working | |
3 credentials to supported cloud infrastructure. | |
4 """ | |
5 from . import GalaxyTestBase, test_util | |
6 | |
7 | |
8 class TestGalaxyUsers(GalaxyTestBase.GalaxyTestBase): | |
9 | |
10 def test_get_users(self): | |
11 users = self.gi.users.get_users() | |
12 for user in users: | |
13 self.assertIsNotNone(user['id']) | |
14 self.assertIsNotNone(user['email']) | |
15 | |
16 def test_show_user(self): | |
17 current_user = self.gi.users.get_current_user() | |
18 user = self.gi.users.show_user(current_user['id']) | |
19 self.assertEqual(user['id'], current_user['id']) | |
20 self.assertEqual(user['username'], current_user['username']) | |
21 self.assertEqual(user['email'], current_user['email']) | |
22 # The 2 following tests randomly fail | |
23 # self.assertEqual(user['nice_total_disk_usage'], current_user['nice_total_disk_usage']) | |
24 # self.assertEqual(user['total_disk_usage'], current_user['total_disk_usage']) | |
25 | |
26 @test_util.skip_unless_galaxy('release_16.01') | |
27 def test_create_remote_user(self): | |
28 # WARNING: only admins can create users! | |
29 # WARNING: Users cannot be purged through the Galaxy API, so execute | |
30 # this test only on a disposable Galaxy instance! | |
31 if not self.gi.config.get_config()['use_remote_user']: | |
32 self.skipTest('This Galaxy instance is not configured to use remote users') | |
33 new_user_email = 'newuser@example.com' | |
34 user = self.gi.users.create_remote_user(new_user_email) | |
35 self.assertEqual(user['email'], new_user_email) | |
36 if self.gi.config.get_config()['allow_user_deletion']: | |
37 deleted_user = self.gi.users.delete_user(user['id']) | |
38 self.assertEqual(deleted_user['email'], new_user_email) | |
39 self.assertTrue(deleted_user['deleted']) | |
40 | |
41 @test_util.skip_unless_galaxy('release_16.01') | |
42 def test_create_local_user(self): | |
43 # WARNING: only admins can create users! | |
44 # WARNING: Users cannot be purged through the Galaxy API, so execute | |
45 # this test only on a disposable Galaxy instance! | |
46 if self.gi.config.get_config()['use_remote_user']: | |
47 self.skipTest('This Galaxy instance is not configured to use local users') | |
48 new_user_email = 'newuser@example.com' | |
49 user = self.gi.users.create_local_user('newuser', new_user_email, 'secret') | |
50 self.assertEqual(user['username'], 'newuser') | |
51 self.assertEqual(user['email'], new_user_email) | |
52 if self.gi.config.get_config()['allow_user_deletion']: | |
53 deleted_user = self.gi.users.delete_user(user['id']) | |
54 self.assertEqual(deleted_user['email'], new_user_email) | |
55 self.assertTrue(deleted_user['deleted']) | |
56 | |
57 def test_get_current_user(self): | |
58 user = self.gi.users.get_current_user() | |
59 self.assertIsNotNone(user['id']) | |
60 self.assertIsNotNone(user['username']) | |
61 self.assertIsNotNone(user['email']) | |
62 self.assertIsNotNone(user['nice_total_disk_usage']) | |
63 self.assertIsNotNone(user['total_disk_usage']) |