Tests: No login needed when there is no password

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER 2021-01-16 12:39:21 +01:00
parent 992fac4bde
commit b7f94c7850
No known key found for this signature in database
GPG Key ID: 00135ACBD90B28DD
1 changed files with 9 additions and 1 deletions

View File

@ -703,7 +703,15 @@
[[ ${lines[0]} == "Error 404: Not Found" ]]
}
@test "API authorization: Getting challenge" {
@test "API authorization (without password): No login required" {
run bash -c 'curl -s 127.0.0.1:8080/api/auth'
printf "%s\n" "${lines[@]}"
[[ ${lines[0]} == '{"session":{"valid":true,"sid":null,"validity":null}}' ]]
}
@test "API authorization (with password): FTL challenges us" {
# Password: ABC
echo "WEBPASSWORD=183c1b634da0078fcf5b0af84bdcbb3e817708c3f22b329be84165f4bad1ae48" >> /etc/pihole/setupVars.conf
run bash -c 'curl -s 127.0.0.1:8080/api/auth'
printf "%s\n" "${lines[@]}"
[[ ${lines[0]} == "{\"challenge\":\""* ]]