From b7f94c78506728ec2a4712bf5bd5f0210cd837bf Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 16 Jan 2021 12:39:21 +0100 Subject: [PATCH] Tests: No login needed when there is no password Signed-off-by: DL6ER --- test/test_suite.bats | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/test_suite.bats b/test/test_suite.bats index 168711ea..eabd9b1a 100644 --- a/test/test_suite.bats +++ b/test/test_suite.bats @@ -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\":\""* ]]