mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-24 12:13:33 +08:00
Split test/base into lib/galaxy_test/base and lib/galaxy_test/driver. Dividing things on whether they import galaxy-app code or not - with the goal of a galaxy-test-base package that doesn't depend on galaxy-app and a galaxy-test-driver package that does. I've been refactoring around this division for a long time. Certain tests (namely the integration tests) always need to bootstrap Galaxy - but the API tests and the Selenium tests should be installable and runnable without Galaxy in the Python environment. So future galaxy-test-api and galaxy-test-selenium packages should have only an optional dependency on galaxy-test-driver. Properly sturcturing these namespaces is a precursor for real packages on PyPI, clean separation of the tool shed testing code, and cleans up all the flake8 noqa hacks in test/.
59 lines
2.1 KiB
Python
59 lines
2.1 KiB
Python
"""Integration tests for user config options."""
|
|
|
|
from galaxy_test.driver import integration_util
|
|
|
|
|
|
class _BaseUserExposeIntegerationTestCase(integration_util.IntegrationTestCase):
|
|
|
|
def original_user_ids(self):
|
|
return [u["id"] for u in self.galaxy_interactor.get("users").json()]
|
|
|
|
def new_users(self, original_ids):
|
|
users = [u for u in self.galaxy_interactor.get("users").json() if u["id"] not in original_ids]
|
|
return users
|
|
|
|
|
|
class DefaultUserExposeIntegrationTestCase(_BaseUserExposeIntegerationTestCase):
|
|
|
|
def test_defaults(self):
|
|
original_user_ids = self.original_user_ids()
|
|
self.galaxy_interactor.ensure_user_with_email("defaultuserexposetest@galaxyproject.org")
|
|
new_users = self.new_users(original_user_ids)
|
|
# If expose username or expose email isn't enabled - user indexing is
|
|
# empty by default for non-admin users.
|
|
assert len(new_users) == 0
|
|
|
|
|
|
class EmailUserExposeIntegrationTestCase(_BaseUserExposeIntegerationTestCase):
|
|
|
|
@classmethod
|
|
def handle_galaxy_config_kwds(cls, config):
|
|
config["expose_user_email"] = True
|
|
|
|
def test_only_email_exposed(self):
|
|
original_user_ids = self.original_user_ids()
|
|
self.galaxy_interactor.ensure_user_with_email("emailuserexposetest@galaxyproject.org")
|
|
new_users = self.new_users(original_user_ids)
|
|
assert len(new_users) > 0
|
|
user = new_users[0]
|
|
assert "email" in user
|
|
assert "username" not in user
|
|
assert "last_password_change" not in user
|
|
|
|
|
|
class UsernameUserExposeIntegrationTestCase(_BaseUserExposeIntegerationTestCase):
|
|
|
|
@classmethod
|
|
def handle_galaxy_config_kwds(cls, config):
|
|
config["expose_user_name"] = True
|
|
|
|
def test_only_username_exposed(self):
|
|
original_user_ids = self.original_user_ids()
|
|
self.galaxy_interactor.ensure_user_with_email("usernameuserexposetest@galaxyproject.org")
|
|
new_users = self.new_users(original_user_ids)
|
|
assert len(new_users) > 0
|
|
user = new_users[0]
|
|
assert "email" not in user
|
|
assert "username" in user
|
|
assert "last_password_change" not in user
|