Created
October 7, 2015 18:17
-
-
Save dvliman/73a0da5c90e2d940a792 to your computer and use it in GitHub Desktop.
unsent-count-flow
This file contains hidden or 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
unsent_count(Config) -> | |
Org = proplists:get_value(org, Config), | |
ok = tt_devapi_test_utils:xmpp_call(tt_org_data, set_billing, [Org, "active"]), | |
ok = tt_devapi_test_utils:xmpp_call(tt_pubsub_data, publish_organization, [Org]), | |
User2 = proplists:get_value(token2, Config), | |
User3 = proplists:get_value(token3, Config), | |
Auth = {basic_auth, proplists:get_value(impersonate_auth, Config)}, | |
% start with all unsent-welcome-email users, and it should decrement | |
% as we remove user from organization or send welcome email to that user | |
UnsentCount = request_unsent_count(Config, Auth), | |
tt_devapi_test_utils:xmpp_call(tt_account_data, set_welcome_email_sent, [User2, Org, true]), | |
UnsentCount1 = request_unsent_count(Config, Auth), | |
true = UnsentCount1 < UnsentCount, | |
% now deleting that User2 shouldn't affect the unsent-count. That user has been sent! | |
tt_devapi_test_utils:xmpp_call(tt_account, delete_account, [User2]), | |
UnsentCount1 = request_unsent_count(Config, Auth), | |
% deleting unsent user should decrement the total unsent | |
tt_devapi_test_utils:xmpp_call(tt_account, delete_account, [User3]), | |
UnsentCount2 = request_unsent_count(Config, Auth), | |
true = UnsentCount2 < UnsentCount1. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment