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.selenium.test_history_sharing
from .framework import (
selenium_test,
SeleniumTestCase
)
# Remove hack when submit_login works more consistently.
VALID_LOGIN_RETRIES = 3
[docs]class HistorySharingTestCase(SeleniumTestCase):
[docs] @selenium_test
def test_sharing_valid(self):
user1_email, user2_email, history_id = self.setup_two_users_with_one_shared_history()
self.submit_login(user2_email, retries=VALID_LOGIN_RETRIES)
response = self.api_get("histories/%s" % history_id, raw=True)
assert response.status_code == 200, response.text
[docs] @selenium_test
def test_sharing_valid_by_id(self):
user1_email, user2_email, history_id = self.setup_two_users_with_one_shared_history(share_by_id=True)
self.submit_login(user2_email, retries=VALID_LOGIN_RETRIES)
response = self.api_get("histories/%s" % history_id, raw=True)
assert response.status_code == 200, response.text
[docs] @selenium_test
def test_unsharing(self):
user1_email, user2_email, history_id = self.setup_two_users_with_one_shared_history()
self.submit_login(user1_email, retries=VALID_LOGIN_RETRIES)
self.navigate_to_history_share_page()
unshare_user_button = self.components.histories.sharing.unshare_user_button
unshare_user_button.wait_for_and_click()
self.navigate_to_history_share_page()
unshare_user_button.assert_absent()
self.logout_if_needed()
self.submit_login(user2_email, retries=VALID_LOGIN_RETRIES)
response = self.api_get("histories/%s" % history_id, raw=True)
assert response.status_code == 403
[docs] @selenium_test
def test_sharing_with_invalid_user(self):
user1_email = self._get_random_email()
self.register(user1_email)
self.share_history_with_user(user_email="invalid_user@test.com")
self.assert_error_message(contains='is not a valid Galaxy user')
[docs] @selenium_test
def test_sharing_with_self(self):
user1_email = self._get_random_email()
self.register(user1_email)
self.share_history_with_user(user_email=user1_email)
self.assert_error_message(contains='You cannot send histories to yourself')