Stage 10 final

This commit is contained in:
2026-04-22 23:15:20 +03:00
parent e3a08cfa04
commit 081dcf9588
85 changed files with 2116 additions and 160 deletions

View File

@@ -0,0 +1,23 @@
-module(handler_search_tests).
-include_lib("eunit/include/eunit.hrl").
handler_search_test_() ->
case is_server_running() of
true ->
[
{"Search API requires authentication", fun test_search_requires_auth/0}
];
false ->
io:format("Skipping handler tests: server not running~n"),
[]
end.
is_server_running() ->
case httpc:request(get, {"http://localhost:8080/health", []}, [], [{timeout, 1000}]) of
{ok, {{_, 200, _}, _, _}} -> true;
_ -> false
end.
test_search_requires_auth() ->
{ok, {{_, 401, _}, _, Body}} = httpc:request(get, {"http://localhost:8080/v1/search?type=event", []}, [], []),
?assertMatch(#{<<"error">> := _}, jsx:decode(Body, [return_maps])).