Mercurial > repos > guerler > springsuite
comparison planemo/lib/python3.7/site-packages/bioblend/_tests/TestGalaxyFolders.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 from . import GalaxyTestBase | |
2 | |
3 FOO_DATA = 'foo\nbar\n' | |
4 | |
5 | |
6 class TestGalaxyFolders(GalaxyTestBase.GalaxyTestBase): | |
7 | |
8 def setUp(self): | |
9 super().setUp() | |
10 self.name = 'automated test folder' | |
11 self.library = self.gi.libraries.create_library(self.name, description='automated test', synopsis='automated test synopsis') | |
12 self.folder = self.gi.folders.create_folder(self.library['root_folder_id'], self.name, | |
13 description="automatically created folder") | |
14 | |
15 def tearDown(self): | |
16 self.gi.libraries.delete_library(self.library['id']) | |
17 | |
18 def test_create_folder(self): | |
19 self.assertEqual(self.folder['name'], self.name) | |
20 self.assertEqual(self.folder['description'], 'automatically created folder') | |
21 | |
22 def test_show_folder(self): | |
23 f2 = self.gi.folders.show_folder(self.folder['id']) | |
24 self.assertEqual(f2['id'], self.folder['id']) | |
25 | |
26 def test_show_folder_contents(self): | |
27 f2 = self.gi.folders.show_folder(self.folder['id'], contents=True) | |
28 self.assertIn('folder_contents', f2) | |
29 self.assertIn('metadata', f2) | |
30 self.assertEqual(self.name, f2['metadata']['folder_name']) | |
31 | |
32 def test_delete_folder(self): | |
33 self.sub_folder = self.gi.folders.create_folder(self.folder['id'], self.name) | |
34 self.gi.folders.delete_folder(self.sub_folder['id']) | |
35 | |
36 def test_update_folder(self): | |
37 self.folder = self.gi.folders.update_folder(self.folder['id'], 'new-name', 'new-description') | |
38 self.assertEqual(self.folder['name'], 'new-name') | |
39 self.assertEqual(self.folder['description'], 'new-description') | |
40 | |
41 def test_get_set_permissions(self): | |
42 empty_permission = {'add_library_item_role_list': [], 'modify_folder_role_list': [], 'manage_folder_role_list': []} | |
43 # They should be empty to start with | |
44 self.assertEqual( | |
45 self.gi.folders.get_permissions(self.folder['id'], scope='current'), | |
46 empty_permission | |
47 ) | |
48 self.assertEqual( | |
49 self.gi.folders.get_permissions(self.folder['id'], scope='available'), | |
50 empty_permission | |
51 ) | |
52 # Then we'll add a role | |
53 role = self.gi.roles.get_roles()[0] | |
54 self.gi.folders.set_permissions(self.folder['id'], add_ids=[role['id']]) | |
55 self.assertTrue( | |
56 role['id'] in | |
57 self.gi.folders.get_permissions(self.folder['id'], scope='available')['add_library_item_role_list'][0] | |
58 ) |