fix(api): resolve public calendar GET by unique short_name.
CI / test (push) Successful in 7m28s
CI / deploy-ift (push) Successful in 2m46s
CI / e2e-ift (push) Successful in 1m26s
CI / deploy-stage (push) Successful in 2m4s
CI / e2e-stage (push) Successful in 2m4s

This commit is contained in:
2026-08-14 15:00:41 +03:00
parent 658cbda4fe
commit 3d7ae0d372
8 changed files with 67 additions and 18 deletions
@@ -20,6 +20,7 @@ test() ->
test_get_calendar(Token, CalId),
test_get_calendar_guest(Token, CalId),
test_get_calendar_guest_short_name(Token, CalId),
test_get_calendar_not_found(Token),
test_update_calendar(Token, CalId),
test_update_calendar_settings(Token, CalId),
@@ -49,6 +50,20 @@ test_get_calendar_guest(Token, CalId) ->
{ok, 403, _, _} = api_test_runner:client_request(get, PPath, <<>>),
ct:pal(" OK: guest commercial 200, personal 403").
test_get_calendar_guest_short_name(Token, CalId) ->
ct:pal(" TEST: Guest GET commercial by short_name"),
PathId = <<"/v1/calendars/", CalId/binary>>,
Slug2 = <<"sn", (integer_to_binary(erlang:unique_integer([positive])))/binary>>,
_ = api_test_runner:client_put(PathId, Token, #{short_name => Slug2}),
PathSlug = <<"/v1/calendars/", Slug2/binary>>,
{ok, 200, _, Body} = api_test_runner:client_request(get, PathSlug, <<>>),
Dec = jsx:decode(list_to_binary(Body), [return_maps]),
?assertEqual(CalId, maps:get(<<"id">>, Dec)),
?assertEqual(Slug2, maps:get(<<"short_name">>, Dec)),
EvPath = <<"/v1/calendars/", Slug2/binary, "/events">>,
{ok, 200, _, _} = api_test_runner:client_request(get, EvPath, <<>>),
ct:pal(" OK: guest GET by short_name").
test_get_calendar_not_found(Token) ->
ct:pal(" TEST: Get non-existent calendar (404)"),
Resp = api_test_runner:client_request(get, <<"/v1/calendars/fakeid">>, Token),