def test_all_repos_private(self, session_browser): """Test repo accessability when all repos are private.""" _create_repo(session_browser, 'Test-repo', 'private', ok_if_exists=True) _set_all_repos_private(session_browser) if not functional.user_exists(session_browser, 'gitweb_user'): functional.create_user(session_browser, 'gitweb_user', groups=['git-access']) if not functional.user_exists(session_browser, 'nogroupuser'): functional.create_user(session_browser, 'nogroupuser', groups=[]) functional.login_with_account(session_browser, functional.base_url, 'gitweb_user') assert functional.is_available(session_browser, 'gitweb') assert len(functional.find_on_front_page(session_browser, 'gitweb')) == 1 functional.login_with_account(session_browser, functional.base_url, 'nogroupuser') assert not functional.is_available(session_browser, 'gitweb') assert len(functional.find_on_front_page(session_browser, 'gitweb')) == 0 functional.logout(session_browser) functional.access_url(session_browser, 'gitweb') assert functional.is_login_prompt(session_browser) assert len(functional.find_on_front_page(session_browser, 'gitweb')) == 0
def test_both_private_and_public_repo_exist(self, session_browser): """Tests when both private and public repo exist.""" _create_repo(session_browser, 'Test-repo', 'public', True) _create_repo(session_browser, 'Test-repo-private', 'private', True) functional.logout(session_browser) assert _site_repo_exists(session_browser, 'Test-repo') assert not _site_repo_exists(session_browser, 'Test-repo-private')
def test_app_access(session_browser): """Test that only logged-in users can access Syncthing web interface.""" functional.logout(session_browser) functional.access_url(session_browser, 'syncthing') assert functional.is_login_prompt(session_browser) functional.login(session_browser) functional.access_url(session_browser, 'syncthing') assert functional.is_available(session_browser, 'syncthing')
def test_share_permissions(session_browser): """Test share permissions.""" _remove_share(session_browser, 'tmp') _add_share(session_browser, 'tmp', '/tmp', 'syncthing-access') _verify_share(session_browser, 'tmp', '/tmp', 'syncthing-access') _verify_inaccessible_share(session_browser, 'tmp') _make_share_public(session_browser, 'tmp') functional.logout(session_browser) assert functional.is_available(session_browser, 'share_tmp') functional.login(session_browser)
def test_preserve_public_access_setting(session_browser): """Test that public access setting is preserved when disabling and re-enabling the app.""" functional.login(session_browser) functional.app_enable(session_browser, 'searx') _enable_public_access(session_browser) functional.app_disable(session_browser, 'searx') functional.app_enable(session_browser, 'searx') functional.logout(session_browser) assert functional.is_visible_on_front_page(session_browser, 'searx') assert functional.is_available(session_browser, 'searx')
def test_private_mode(session_browser): """Test that site is not available without login in public mode.""" functional.app_enable(session_browser, 'wordpress') _enable_public_mode(session_browser, False) def login_prompt(): _load_site(session_browser) return functional.is_login_prompt(session_browser) try: functional.logout(session_browser) functional.eventually(login_prompt) finally: functional.login(session_browser)
def test_public_access(session_browser): """Test enabling public access.""" functional.app_enable(session_browser, 'searx') # Enable public access _enable_public_access(session_browser) functional.logout(session_browser) assert functional.is_visible_on_front_page(session_browser, 'searx') assert functional.is_available(session_browser, 'searx') # Disable public access functional.login(session_browser) _disable_public_access(session_browser) functional.logout(session_browser) assert not functional.is_visible_on_front_page(session_browser, 'searx') assert not functional.is_available(session_browser, 'searx')
def can_log_in_with_password(session_browser, username, password): functional.logout(session_browser) functional.login_with_account(session_browser, functional.base_url, username, password) assert len(session_browser.find_by_id('id_user_menu')) > 0
def log_out_user(session_browser): functional.logout(session_browser)