fix(api): resolve public calendar GET by unique short_name.
This commit is contained in:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user