Пример #1
0
    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
Пример #2
0
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')
Пример #3
0
 def login_prompt():
     _load_site(session_browser)
     return functional.is_login_prompt(session_browser)
Пример #4
0
def prompted_for_login(session_browser):
    assert functional.is_login_prompt(session_browser)