fix(ct): adapt API tests to sole Default personal
CI / test (push) Successful in 8m11s
CI / deploy-ift (push) Successful in 3m30s
CI / e2e-ift (push) Successful in 6m10s
CI / deploy-stage (push) Successful in 3m3s
CI / e2e-stage (push) Successful in 1m15s

Default create_calendar to commercial; reuse existing personal on 409;
assert verify title Default; cover personal_exists / default_calendar.

Refs EventHub/EventHubBack#64
This commit is contained in:
2026-07-30 22:29:52 +03:00
parent 10464de3ec
commit 7d39c004a1
5 changed files with 68 additions and 37 deletions
+12 -5
View File
@@ -13,11 +13,10 @@ test() ->
ct:pal("=== User Calendars Tests ==="),
Token = api_test_runner:get_user_token(),
% Создаём один календарь для тестов
#{<<"id">> := CalId} = api_test_runner:client_post(<<"/v1/calendars">>, Token,
#{title => <<"TestCal">>, type => <<"personal">>}),
_CalId = api_test_runner:create_calendar(Token, #{title => <<"TestCal">>}),
test_create_calendar(Token),
test_second_personal_rejected(Token),
test_list_calendars(Token),
test_list_calendars_unauthorized(),
@@ -25,15 +24,23 @@ test() ->
ok.
test_create_calendar(Token) ->
ct:pal(" TEST: Create a new calendar"),
ct:pal(" TEST: Create a new studio calendar"),
api_test_runner:ensure_commercial_subscription(Token),
Resp = api_test_runner:client_request(post, <<"/v1/calendars">>, Token,
jsx:encode(#{title => <<"NewCal">>, type => <<"personal">>})),
jsx:encode(#{title => <<"NewCal">>, type => <<"commercial">>})),
{ok, 201, _, Body} = Resp,
#{<<"id">> := Id, <<"title">> := Title} = jsx:decode(list_to_binary(Body), [return_maps]),
?assert(is_binary(Id)),
?assertEqual(<<"NewCal">>, Title),
ct:pal(" OK: created calendar ~s", [Id]).
test_second_personal_rejected(Token) ->
ct:pal(" TEST: Second personal calendar rejected (409)"),
Resp = api_test_runner:client_request(post, <<"/v1/calendars">>, Token,
jsx:encode(#{title => <<"AnotherPersonal">>, type => <<"personal">>})),
?assertMatch({ok, 409, _, _}, Resp),
ct:pal(" OK: got 409 personal_exists").
test_list_calendars(Token) ->
ct:pal(" TEST: List user calendars"),
Calendars = api_test_runner:client_get(<<"/v1/calendars">>, Token),