fix(test): lookup banned words via q after batch
CI / test (push) Successful in 6m38s
CI / deploy-ift (push) Successful in 6m53s
CI / e2e-ift (push) Successful in 2m16s
CI / deploy-stage (push) Successful in 2m15s
CI / e2e-stage (push) Successful in 1m17s

Bare GET /banned-words is paginated (limit 50); on dirty IFT the
batch words fall off page 1 and admin_test_banned_words flakes.
Assert via ?q= like the single-add case; same for delete check.
This commit is contained in:
2026-07-29 15:58:41 +03:00
parent faf251b11d
commit 4c480f1c43
+10 -4
View File
@@ -122,8 +122,14 @@ test_batch_add_words(Token) ->
Result = jsx:decode(list_to_binary(RespBody), [return_maps]),
?assertEqual(3, maps:get(<<"added">>, Result)),
?assertEqual(0, maps:get(<<"skipped">>, Result)),
AllWords = api_test_runner:admin_get(<<"/v1/admin/banned-words">>, Token),
[?assert(lists:any(fun(W) -> maps:get(<<"word">>, W) =:= Word end, AllWords)) || Word <- Words],
%% Lookup via ?q= — bare GET is paginated and flakes on dirty IFT stands.
lists:foreach(
fun(Word) ->
Found = api_test_runner:admin_get(<<"/v1/admin/banned-words?q=", Word/binary>>, Token),
?assertEqual(1, length(Found)),
?assertEqual(Word, maps:get(<<"word">>, hd(Found)))
end,
Words),
ct:pal(" OK").
%% @doc DELETE /v1/admin/banned-words/:word удаление слова.
@@ -132,8 +138,8 @@ test_delete_word(Token, Word) ->
Path = <<"/v1/admin/banned-words/", Word/binary>>,
Result = api_test_runner:admin_delete(Path, Token),
?assertEqual(<<"deleted">>, maps:get(<<"status">>, Result)),
Words = api_test_runner:admin_get(<<"/v1/admin/banned-words">>, Token),
?assertNot(lists:any(fun(W) -> maps:get(<<"word">>, W) =:= Word end, Words)),
Left = api_test_runner:admin_get(<<"/v1/admin/banned-words?q=", Word/binary>>, Token),
?assert(lists:all(fun(W) -> maps:get(<<"word">>, W) =/= Word end, Left)),
ct:pal(" OK").
%% @doc PUT /v1/admin/banned-words/:word попытка переименовать в уже существующее слово (409).