Mercurial > repos > guerler > springsuite
comparison planemo/lib/python3.7/site-packages/bioblend/_tests/TestGalaxyUsers.py @ 0:d30785e31577 draft
"planemo upload commit 6eee67778febed82ddd413c3ca40b3183a3898f1"
author | guerler |
---|---|
date | Fri, 31 Jul 2020 00:18:57 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:d30785e31577 |
---|---|
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 | |
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 def test_create_remote_user(self): | |
27 # WARNING: only admins can create users! | |
28 # WARNING: Users cannot be purged through the Galaxy API, so execute | |
29 # this test only on a disposable Galaxy instance! | |
30 if not self.gi.config.get_config()['use_remote_user']: | |
31 self.skipTest('This Galaxy instance is not configured to use remote users') | |
32 new_user_email = 'newuser@example.com' | |
33 user = self.gi.users.create_remote_user(new_user_email) | |
34 self.assertEqual(user['email'], new_user_email) | |
35 if self.gi.config.get_config()['allow_user_deletion']: | |
36 deleted_user = self.gi.users.delete_user(user['id']) | |
37 self.assertEqual(deleted_user['email'], new_user_email) | |
38 self.assertTrue(deleted_user['deleted']) | |
39 | |
40 def test_create_local_user(self): | |
41 # WARNING: only admins can create users! | |
42 # WARNING: Users cannot be purged through the Galaxy API, so execute | |
43 # this test only on a disposable Galaxy instance! | |
44 if self.gi.config.get_config()['use_remote_user']: | |
45 self.skipTest('This Galaxy instance is not configured to use local users') | |
46 new_user_email = 'newuser@example.com' | |
47 user = self.gi.users.create_local_user('newuser', new_user_email, 'secret') | |
48 self.assertEqual(user['username'], 'newuser') | |
49 self.assertEqual(user['email'], new_user_email) | |
50 if self.gi.config.get_config()['allow_user_deletion']: | |
51 deleted_user = self.gi.users.delete_user(user['id']) | |
52 self.assertEqual(deleted_user['email'], new_user_email) | |
53 self.assertTrue(deleted_user['deleted']) | |
54 | |
55 def test_get_current_user(self): | |
56 user = self.gi.users.get_current_user() | |
57 self.assertIsNotNone(user['id']) | |
58 self.assertIsNotNone(user['username']) | |
59 self.assertIsNotNone(user['email']) | |
60 self.assertIsNotNone(user['nice_total_disk_usage']) | |
61 self.assertIsNotNone(user['total_disk_usage']) | |
62 | |
63 def test_update_user(self): | |
64 # WARNING: only admins can create users! | |
65 # WARNING: Users cannot be purged through the Galaxy API, so execute | |
66 # this test only on a disposable Galaxy instance! | |
67 if self.gi.config.get_config()['use_remote_user']: | |
68 self.skipTest('This Galaxy instance is not configured to use local users') | |
69 new_user_email = 'newuser2@example.com' | |
70 user = self.gi.users.create_local_user('newuser2', new_user_email, 'secret') | |
71 self.assertEqual(user['username'], 'newuser2') | |
72 self.assertEqual(user['email'], new_user_email) | |
73 | |
74 updated_user_email = 'updateduser@example.com' | |
75 updated_username = 'updateduser' | |
76 user_id = user['id'] | |
77 self.gi.users.update_user(user_id, username=updated_username, email=updated_user_email) | |
78 user = self.gi.users.show_user(user_id) | |
79 self.assertEqual(user['username'], updated_username) | |
80 self.assertEqual(user['email'], updated_user_email) | |
81 | |
82 if self.gi.config.get_config()['allow_user_deletion']: | |
83 self.gi.users.delete_user(user['id']) |