Warning
This document is for an in-development version of Galaxy. You can alternatively view this page in the latest release if it exists or view the top of the latest release's documentation.
Source code for galaxy_test.api.test_configuration
from galaxy_test.base.api_asserts import (
assert_has_keys,
assert_not_has_keys,
)
from galaxy_test.base.populators import (
LibraryPopulator
)
from ._framework import ApiTestCase
TEST_KEYS_FOR_ALL_USERS = [
'enable_unique_workflow_defaults',
'ftp_upload_site',
'wiki_url',
'support_url',
'logo_url',
'terms_url',
'allow_user_dataset_purge',
]
TEST_KEYS_FOR_ADMIN_ONLY = [
'library_import_dir',
'user_library_import_dir',
'allow_library_path_paste',
'allow_user_deletion',
]
[docs]class ConfigurationApiTestCase(ApiTestCase):
[docs] def setUp(self):
super(ConfigurationApiTestCase, self).setUp()
self.library_populator = LibraryPopulator(self.galaxy_interactor)
[docs] def test_normal_user_configuration(self):
config = self._get_configuration()
assert_has_keys(config, *TEST_KEYS_FOR_ALL_USERS)
assert_not_has_keys(config, *TEST_KEYS_FOR_ADMIN_ONLY)
[docs] def test_admin_user_configuration(self):
config = self._get_configuration(admin=True)
assert_has_keys(config, *TEST_KEYS_FOR_ALL_USERS)
assert_has_keys(config, *TEST_KEYS_FOR_ADMIN_ONLY)
[docs] def test_admin_decode_id(self):
new_lib = self.library_populator.new_library('DecodeTestLibrary')
decode_response = self._get("configuration/decode/" + new_lib["id"], admin=True)
response_id = decode_response.json()["decoded_id"]
decoded_library_id = self.security.decode_id(new_lib["id"])
assert decoded_library_id == response_id
# fake valid folder id by prepending F
valid_encoded_folder_id = 'F' + new_lib["id"]
folder_decode_response = self._get("configuration/decode/" + valid_encoded_folder_id, admin=True)
folder_response_id = folder_decode_response.json()["decoded_id"]
assert decoded_library_id == folder_response_id
[docs] def test_normal_user_decode_id(self):
decode_response = self._get("configuration/decode/badhombre", admin=False)
self._assert_status_code_is(decode_response, 403)
def _get_configuration(self, data={}, admin=False):
response = self._get("configuration", data=data, admin=admin)
self._assert_status_code_is(response, 200)
configuration = response.json()
return configuration