From 5da282eb8dce47ee4640740dc6edc8e31075fc92 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 8 Nov 2023 09:47:00 +0100 Subject: [PATCH] Tests: Add tests that both /api/history and /api/history/clients return full 24h data Signed-off-by: DL6ER --- test/test_suite.bats | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/test_suite.bats b/test/test_suite.bats index 9355df66..b5de84d8 100644 --- a/test/test_suite.bats +++ b/test/test_suite.bats @@ -1292,6 +1292,18 @@ [[ ${lines[0]} == '"xn--bc-uia.com"' ]] } +@test "API history: Returns full 24 hours even if only a few queries are made" { + run bash -c 'curl -s 127.0.0.1/api/history | jq ".history | length"' + printf "%s\n" "${lines[@]}" + [[ ${lines[0]} == "145" ]] +} + +@test "API history/clients: Returns full 24 hours even if only a few queries are made" { + run bash -c 'curl -s 127.0.0.1/api/history/clients | jq ".history | length"' + printf "%s\n" "${lines[@]}" + [[ ${lines[0]} == "145" ]] +} + @test "API authorization (without password): No login required" { run bash -c 'curl -s 127.0.0.1/api/auth' printf "%s\n" "${lines[@]}"