-
Notifications
You must be signed in to change notification settings - Fork 428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Xeps/bind2 inlines #4114
Merged
Merged
Xeps/bind2 inlines #4114
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
f1dff45
Separate CSI test helpers from main suite
NelsonVides d36ba8d
unify create and connect user in sasl2 test helper
NelsonVides 7c2b100
Test multiple bind inline feature announcements
NelsonVides e09806e
test bind inline csi, carbons, and sm
NelsonVides 4350e6b
Implement bind2 inlines for csi, cc, sm
NelsonVides 41f35a9
Require origin_sid set in the acc for carbons
NelsonVides b0904ed
Ensure carbons are applied atomically with session establishment
NelsonVides fe707eb
Report full metric name if prepare_metrics fails in mongoose_admin_api
arcusfelis 9e1ef30
Fix mod_csi metric creation
NelsonVides fe9e2ca
Add test for sm enable with resumption on bind
NelsonVides f5009c1
Refactor and correct behaviour for inline SM
NelsonVides 2bc147d
Test receiving stream features after bind, sasl2 enforces that
NelsonVides 7fa160d
Fix verifying that the user-agent id is UUIDv4
NelsonVides da985bc
Fix stream-management interaction with bind2
NelsonVides b0b887e
Correctly send stream features upon sasl2 success
NelsonVides 0e92f49
Fix sasl2 inline sm according to the latest changes to sm XEP
NelsonVides File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
-module(csi_helper). | ||
-compile([export_all, nowarn_export_all]). | ||
|
||
-include_lib("exml/include/exml.hrl"). | ||
|
||
-define(NS_CSI, <<"urn:xmpp:csi:0">>). | ||
|
||
given_client_is_active(Alice) -> | ||
escalus:send(Alice, csi_helper:csi_stanza(<<"active">>)). | ||
|
||
given_client_is_inactive_and_no_messages_arrive(Alice) -> | ||
escalus:send(Alice, csi_stanza(<<"inactive">>)), | ||
then_client_does_not_receive_any_message(Alice). | ||
|
||
given_messages_are_sent(Alice, Bob, N) -> | ||
Msgs = gen_msgs(<<"Hi, Alice">>, N), | ||
send_msgs(Bob, Alice, Msgs), | ||
Msgs. | ||
|
||
then_client_does_not_receive_any_message(Alice) -> | ||
[] = escalus:wait_for_stanzas(Alice, 1, 100), | ||
escalus_assert:has_no_stanzas(Alice). | ||
|
||
then_client_receives_message(Alice, Msgs) -> | ||
[escalus:assert(is_chat_message, [Msg], escalus:wait_for_stanza(Alice)) || | ||
Msg <- Msgs]. | ||
|
||
gen_msgs(Prefix, N) -> | ||
[<<Prefix/binary, ": ", (integer_to_binary(I))/binary>> || I <- lists:seq(1, N)]. | ||
|
||
send_msgs(From, To, Msgs) -> | ||
[escalus:send(From, escalus_stanza:chat_to(To, Msg)) || Msg <- Msgs]. | ||
|
||
csi_stanza(Name) -> | ||
#xmlel{name = Name, | ||
attrs = [{<<"xmlns">>, ?NS_CSI}]}. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that
given
/when
/then
prefixes in helpers are confusing, but it can be a matter of preference. For me they hinder code reuse, e.g. here we have athen
ingiven
, which already breaks the pattern. If the helper function was calledassert_client_does_not_receive_any_message
, it would look cleaner.So we could get rid of the
given
/then
prefixes, but I see how this code was moved from a suite, so it can stay as it is.