|
|
@ -4,8 +4,8 @@ from flask import url_for
|
|
|
|
def test_check_access_control(app, client):
|
|
|
|
def test_check_access_control(app, client):
|
|
|
|
# Still doesnt work, but this is closer.
|
|
|
|
# Still doesnt work, but this is closer.
|
|
|
|
|
|
|
|
|
|
|
|
with app.test_client() as c:
|
|
|
|
with app.test_client(use_cookies=True) as c:
|
|
|
|
# Check we dont have any password protection enabled yet.
|
|
|
|
# Check we don't have any password protection enabled yet.
|
|
|
|
res = c.get(url_for("settings_page"))
|
|
|
|
res = c.get(url_for("settings_page"))
|
|
|
|
assert b"Remove password" not in res.data
|
|
|
|
assert b"Remove password" not in res.data
|
|
|
|
|
|
|
|
|
|
|
@ -46,15 +46,20 @@ def test_check_access_control(app, client):
|
|
|
|
assert b"BACKUP" in res.data
|
|
|
|
assert b"BACKUP" in res.data
|
|
|
|
assert b"IMPORT" in res.data
|
|
|
|
assert b"IMPORT" in res.data
|
|
|
|
assert b"LOG OUT" in res.data
|
|
|
|
assert b"LOG OUT" in res.data
|
|
|
|
|
|
|
|
assert b"minutes_between_check" in res.data
|
|
|
|
|
|
|
|
assert b"fetch_backend" in res.data
|
|
|
|
|
|
|
|
|
|
|
|
# Now remove the password so other tests function, @todo this should happen before each test automatically
|
|
|
|
res = c.post(
|
|
|
|
res = c.get(url_for("settings_page", removepassword="yes"),
|
|
|
|
url_for("settings_page"),
|
|
|
|
follow_redirects=True)
|
|
|
|
data={
|
|
|
|
assert b"Password protection removed." in res.data
|
|
|
|
"minutes_between_check": 180,
|
|
|
|
|
|
|
|
"tag": "",
|
|
|
|
res = c.get(url_for("index"))
|
|
|
|
"headers": "",
|
|
|
|
assert b"LOG OUT" not in res.data
|
|
|
|
"fetch_backend": "html_webdriver",
|
|
|
|
|
|
|
|
"removepassword_button": "Remove password"
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
follow_redirects=True,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
# There was a bug where saving the settings form would submit a blank password
|
|
|
|
# There was a bug where saving the settings form would submit a blank password
|
|
|
|
def test_check_access_control_no_blank_password(app, client):
|
|
|
|
def test_check_access_control_no_blank_password(app, client):
|
|
|
@ -71,7 +76,6 @@ def test_check_access_control_no_blank_password(app, client):
|
|
|
|
data={"password": "",
|
|
|
|
data={"password": "",
|
|
|
|
"minutes_between_check": 180,
|
|
|
|
"minutes_between_check": 180,
|
|
|
|
'fetch_backend': "html_requests"},
|
|
|
|
'fetch_backend': "html_requests"},
|
|
|
|
|
|
|
|
|
|
|
|
follow_redirects=True
|
|
|
|
follow_redirects=True
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
@ -91,7 +95,8 @@ def test_check_access_no_remote_access_to_remove_password(app, client):
|
|
|
|
# Enable password check.
|
|
|
|
# Enable password check.
|
|
|
|
res = c.post(
|
|
|
|
res = c.post(
|
|
|
|
url_for("settings_page"),
|
|
|
|
url_for("settings_page"),
|
|
|
|
data={"password": "password", "minutes_between_check": 180,
|
|
|
|
data={"password": "password",
|
|
|
|
|
|
|
|
"minutes_between_check": 180,
|
|
|
|
'fetch_backend': "html_requests"},
|
|
|
|
'fetch_backend': "html_requests"},
|
|
|
|
follow_redirects=True
|
|
|
|
follow_redirects=True
|
|
|
|
)
|
|
|
|
)
|
|
|
@ -99,8 +104,17 @@ def test_check_access_no_remote_access_to_remove_password(app, client):
|
|
|
|
assert b"Password protection enabled." in res.data
|
|
|
|
assert b"Password protection enabled." in res.data
|
|
|
|
assert b"Login" in res.data
|
|
|
|
assert b"Login" in res.data
|
|
|
|
|
|
|
|
|
|
|
|
res = c.get(url_for("settings_page", removepassword="yes"),
|
|
|
|
res = c.post(
|
|
|
|
follow_redirects=True)
|
|
|
|
url_for("settings_page"),
|
|
|
|
|
|
|
|
data={
|
|
|
|
|
|
|
|
"minutes_between_check": 180,
|
|
|
|
|
|
|
|
"tag": "",
|
|
|
|
|
|
|
|
"headers": "",
|
|
|
|
|
|
|
|
"fetch_backend": "html_webdriver",
|
|
|
|
|
|
|
|
"removepassword_button": "Remove password"
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
follow_redirects=True,
|
|
|
|
|
|
|
|
)
|
|
|
|
assert b"Password protection removed." not in res.data
|
|
|
|
assert b"Password protection removed." not in res.data
|
|
|
|
|
|
|
|
|
|
|
|
res = c.get(url_for("index"),
|
|
|
|
res = c.get(url_for("index"),
|
|
|
|