Skip to content

Commit

Permalink
Update REST tests with the new mongoose_stanza_api
Browse files Browse the repository at this point in the history
- Update error messages
- Test getting messages for a non-existent user
  • Loading branch information
chrzaszcz committed Oct 21, 2022
1 parent 4405960 commit 1fa2599
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions big_tests/tests/rest_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,9 @@ message_errors(Config) ->
send_message_bin(AliceJID, <<"@noway">>),
{?BAD_REQUEST, <<"Invalid sender JID">>} =
send_message_bin(<<"@noway">>, BobJID),
{?BAD_REQUEST, <<"Unknown user">>} =
{?BAD_REQUEST, <<"User does not exist">>} =
send_message_bin(<<"baduser@", (domain())/binary>>, BobJID),
{?BAD_REQUEST, <<"Unknown domain">>} =
{?BAD_REQUEST, <<"User's domain does not exist">>} =
send_message_bin(<<"baduser@baddomain">>, BobJID).

stanzas_are_sent_and_received(Config) ->
Expand Down Expand Up @@ -297,9 +297,9 @@ stanza_errors(Config) ->
send_stanza(extended_message([{<<"from">>, AliceJid}, {<<"to">>, <<"@invalid">>}])),
{?BAD_REQUEST, <<"Invalid sender JID">>} =
send_stanza(extended_message([{<<"from">>, <<"@invalid">>}, {<<"to">>, BobJid}])),
{?BAD_REQUEST, <<"Unknown domain">>} =
{?BAD_REQUEST, <<"User's domain does not exist">>} =
send_stanza(extended_message([{<<"from">>, <<"baduser@baddomain">>}, {<<"to">>, BobJid}])),
{?BAD_REQUEST, <<"Unknown user">>} =
{?BAD_REQUEST, <<"User does not exist">>} =
send_stanza(extended_message([{<<"from">>, UnknownJid}, {<<"to">>, BobJid}])),
{?BAD_REQUEST, <<"Malformed stanza">>} =
send_stanza(broken_message([{<<"from">>, AliceJid}, {<<"to">>, BobJid}])),
Expand Down Expand Up @@ -347,10 +347,13 @@ messages_are_archived(Config) ->
message_archive_errors(Config) ->
Config1 = escalus_fresh:create_users(Config, [{alice, 1}]),
User = binary_to_list(escalus_users:get_username(Config1, alice)),
Domain = binary_to_list(domain_helper:domain()),
{?NOT_FOUND, <<"Missing owner JID">>} =
gett(admin, "/messages"),
{?BAD_REQUEST, <<"Invalid owner JID">>} =
gett(admin, "/messages/@invalid"),
{?BAD_REQUEST, <<"User does not exist">>} =
gett(admin, "/messages/baduser@" ++ Domain),
{?BAD_REQUEST, <<"Invalid interlocutor JID">>} =
gett(admin, "/messages/" ++ User ++ "/@invalid"),
{?BAD_REQUEST, <<"Invalid limit">>} =
Expand Down

0 comments on commit 1fa2599

Please sign in to comment.