2015-05-04 07:52:28 +00:00
|
|
|
import pytest
|
2015-05-04 05:57:10 +00:00
|
|
|
|
2015-05-04 07:52:28 +00:00
|
|
|
from tests.common.common import ADMIN_PASSWORD
|
|
|
|
|
|
|
|
# TODO: Find a way to test the sudo mode behaviour
|
|
|
|
@pytest.mark.xfail
|
2015-05-04 05:57:10 +00:00
|
|
|
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'
|
|
|
|
)
|
|
|
|
|
|
|
|
b.visit('/sys/groupadmin/')
|
|
|
|
assert b.path == '/sys/groupadmin/', (
|
|
|
|
'once the admin enters the password, '
|
|
|
|
'he would not be asked again within a certain time'
|
|
|
|
)
|