-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test cases and fix for config option new_user_dataset_access_role_def…
…ault_private.
- Loading branch information
Showing
5 changed files
with
54 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,8 +62,8 @@ def _setup_user_get_key(self, email, password=None, is_admin=True): | |
def _different_user(self, email=OTHER_USER): | ||
""" Use in test cases to switch get/post operations to act as new user, | ||
with self._different_user( "[email protected]" ): | ||
self._get( "histories" ) # Gets [email protected] histories. | ||
with self._different_user("[email protected]"): | ||
self._get("histories") # Gets [email protected] histories. | ||
""" | ||
original_api_key = self.user_api_key | ||
original_interactor_key = self.galaxy_interactor.api_key | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from galaxy_test.base.populators import ( | ||
DatasetPopulator | ||
) | ||
from galaxy_test.driver import integration_util | ||
|
||
|
||
class DefaultPermissionsIntegrationTestCase(integration_util.IntegrationTestCase): | ||
expected_access_status_code = 200 | ||
|
||
def setUp(self): | ||
super().setUp() | ||
self.dataset_populator = DatasetPopulator(self.galaxy_interactor) | ||
self.history_id = self.dataset_populator.new_history() | ||
|
||
@classmethod | ||
def handle_galaxy_config_kwds(cls, config): | ||
if hasattr(cls, "new_user_dataset_access_role_default_private"): | ||
config["new_user_dataset_access_role_default_private"] = cls.new_user_dataset_access_role_default_private | ||
|
||
def test_setting(self): | ||
hda = self.dataset_populator.new_dataset(self.history_id, wait=True) | ||
with self._different_user(): | ||
details_response = self.dataset_populator.get_history_dataset_details_raw( | ||
history_id=self.history_id, dataset_id=hda["id"] | ||
) | ||
assert details_response.status_code == self.expected_access_status_code, details_response.content | ||
|
||
|
||
class PrivateDefaultPermissionsIntegrationTestCase(DefaultPermissionsIntegrationTestCase): | ||
new_user_dataset_access_role_default_private = True | ||
expected_access_status_code = 403 | ||
|
||
|
||
class PublicDefaultPermissionsIntegrationTestCase(DefaultPermissionsIntegrationTestCase): | ||
new_user_dataset_access_role_default_private = False | ||
expected_access_status_code = 200 |