1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-06-28 16:08:25 +00:00
seahub/tests/ui/test_sudo_mode.py

41 lines
1.2 KiB
Python
Raw Normal View History

import pytest
from tests.common.common import ADMIN_PASSWORD
# TODO: Find a way to test the sudo mode behaviour
@pytest.mark.xfail
def test_sudo_mode_required(admin_browser_once):
b = admin_browser_once
b.visit('/sys/useradmin/')
assert b.path == '/sys/sudo/', (
'when viewing sysadmin-only pages for the first time, '
'the browser should be redirected to the sudo mode page'
)
b.fill_form({
'password': ADMIN_PASSWORD,
})
b.submit_by_input_name('password')
assert b.path == '/sys/useradmin/', (
'after entering password, '
'the browser should be redirected back to the previous page'
)
2015-05-05 05:34:03 +00:00
@pytest.mark.xfail
def test_sudo_mode_rejects_wrong_password(admin_browser_once):
b = admin_browser_once
b.visit('/sys/useradmin/')
assert b.path == '/sys/sudo/', (
'when viewing sysadmin-only pages for the first time, '
'the browser should be redirected to the sudo mode page'
)
b.fill_form({
'password': 'wrong-password',
})
b.submit_by_input_name('password')
assert b.path == '/sys/sudo/', (
'after entering the wrong password, '
'the browser should still be on the sudo mode page'
)