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_non_admin_users_can_change_own_ssh_keys(session_browser): """Test that non-admin users can change their own ssh keys.""" _non_admin_user_exists(session_browser, 'alice') functional.login_with_account(session_browser, functional.base_url, 'alice') _set_ssh_keys(session_browser, 'somekey456') assert _get_ssh_keys(session_browser) == 'somekey456' functional.login(session_browser)
def test_non_admin_users_can_change_own_password(session_browser): """Test that non-admin users can change their own password.""" _non_admin_user_exists(session_browser, 'alice') functional.login_with_account(session_browser, functional.base_url, 'alice') _change_password(session_browser, 'newpassword123') _can_log_in_with_password(session_browser, 'alice', 'newpassword123') functional.login(session_browser)
def test_user_group(self, session_browser): """Test that only users in vpn group have access.""" functional.app_enable(session_browser, 'openvpn') if not functional.user_exists(session_browser, 'vpnuser'): functional.create_user(session_browser, 'vpnuser', groups=['vpn']) if not functional.user_exists(session_browser, 'nonvpnuser'): functional.create_user(session_browser, 'nonvpnuser', groups=[]) functional.login_with_account(session_browser, base_url, 'vpnuser') _download_profile(session_browser) functional.login_with_account(session_browser, base_url, 'nonvpnuser') _not_on_front_page(session_browser) functional.login(session_browser)
def test_bittorrent_group(self, session_browser): """Test if only users in bit-torrent group can access Deluge.""" functional.app_enable(session_browser, 'deluge') if not functional.user_exists(session_browser, 'delugeuser'): functional.create_user(session_browser, 'delugeuser', groups=['bit-torrent']) if not functional.user_exists(session_browser, 'nogroupuser'): functional.create_user(session_browser, 'nogroupuser') functional.login_with_account(session_browser, functional.base_url, 'delugeuser') assert functional.is_available(session_browser, 'deluge') functional.login_with_account(session_browser, functional.base_url, 'nogroupuser') assert not functional.is_available(session_browser, 'deluge') functional.login(session_browser)
def test_user_group_access(self, session_browser): """Test that only users in syncthing-access group can access syncthing site.""" functional.app_enable(session_browser, self.app_name) if not functional.user_exists(session_browser, 'syncthinguser'): functional.create_user(session_browser, 'syncthinguser', groups=['syncthing-access']) if not functional.user_exists(session_browser, 'nogroupuser'): functional.create_user(session_browser, 'nogroupuser') functional.login_with_account(session_browser, functional.base_url, 'syncthinguser') assert functional.is_available(session_browser, self.app_name) functional.login_with_account(session_browser, functional.base_url, 'nogroupuser') assert not functional.is_available(session_browser, self.app_name) functional.login(session_browser)
def cannot_log_in(session_browser, username): functional.login_with_account(session_browser, functional.base_url, username) assert len(session_browser.find_by_id('id_user_menu')) == 0
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 logged_in_user(session_browser, name): functional.login_with_account(session_browser, functional.base_url, name)