mirror of
https://github.com/dgtlmoon/changedetection.io.git
synced 2025-12-14 12:06:55 +00:00
Password protection / login support (#34)
Issue #24 Password login hashlib.pbkdf2_hmac implementation
This commit is contained in:
@@ -121,3 +121,40 @@ def test_check_basic_change_detection_functionality(client, live_server):
|
||||
# Cleanup everything
|
||||
res = client.get(url_for("api_delete", uuid="all"), follow_redirects=True)
|
||||
assert b'Deleted' in res.data
|
||||
|
||||
|
||||
def test_check_access_control(client):
|
||||
return
|
||||
# @note: does not seem to handle the last logout step correctly, we're still logged in.. but yet..
|
||||
# pytest team keep telling us that we have a new context.. i'm lost :(
|
||||
|
||||
# Add our URL to the import page
|
||||
res = client.post(
|
||||
url_for("settings_page"),
|
||||
data={"password": "foobar"},
|
||||
follow_redirects=True
|
||||
)
|
||||
assert b"LOG OUT" not in res.data
|
||||
|
||||
client.get(url_for("import_page"), follow_redirects=True)
|
||||
assert b"Password" in res.data
|
||||
|
||||
#defaultuser@changedetection.io is actually hardcoded for now, we only use a single password
|
||||
res = client.post(
|
||||
url_for("login"),
|
||||
data={"password": "foobar", "email": "defaultuser@changedetection.io"},
|
||||
follow_redirects=True
|
||||
)
|
||||
|
||||
assert b"LOG OUT" in res.data
|
||||
|
||||
client.get(url_for("settings_page"), follow_redirects=True)
|
||||
assert b"LOG OUT" in res.data
|
||||
|
||||
# Now remove the password so other tests function, @todo this should happen before each test automatically
|
||||
|
||||
print(res.data)
|
||||
client.get(url_for("settings_page", removepassword="true"), follow_redirects=True)
|
||||
|
||||
client.get(url_for("import_page", removepassword="true"), follow_redirects=True)
|
||||
assert b"LOG OUT" not in res.data
|
||||
Reference in New Issue
Block a user