feat(api): optional auth for public search and studio week. Refs EventHub/EventHubFront#58

This commit is contained in:
2026-08-14 11:02:58 +03:00
parent 8a5f254c2a
commit 520af23cc6
7 changed files with 32 additions and 15 deletions
+6 -4
View File
@@ -11,7 +11,7 @@
%%% - поиск с фильтрацией по датам (from/to)
%%% - геопоиск (lat, lon, radius)
%%% - пагинацию результатов
%%% - ошибку 401 без токена
%%% - публичный поиск без токена (200)
%%% @end
%%%-------------------------------------------------------------------
-module(user_search_tests).
@@ -120,7 +120,9 @@ test_search_pagination(Token) ->
ct:pal(" OK").
test_search_unauthorized() ->
ct:pal(" TEST: Search without token"),
ct:pal(" TEST: Search without token (public)"),
Resp = api_test_runner:client_request(get, <<"/v1/search?q=test">>, <<>>),
?assertMatch({ok, 401, _, _}, Resp),
ct:pal(" OK: got 401").
{ok, 200, _, Body} = Resp,
Decoded = jsx:decode(list_to_binary(Body), [return_maps]),
?assert(is_map(Decoded)),
ct:pal(" OK: guest search 200").