diff options
author | Brendan Abolivier <babolivier@matrix.org> | 2019-06-05 16:35:05 +0100 |
---|---|---|
committer | Brendan Abolivier <babolivier@matrix.org> | 2019-06-05 16:35:05 +0100 |
commit | fe13bd52acb67de56fb5e1866d0ec64fff10ed94 (patch) | |
tree | e1513f139c11bfadffcd30652020b851e18a1622 /tests/rest/client/v2_alpha/test_register.py | |
parent | Only parse from email if provided (diff) | |
download | synapse-fe13bd52acb67de56fb5e1866d0ec64fff10ed94.tar.xz |
Don't check whether the user's account is expired on /send_mail requests
Diffstat (limited to 'tests/rest/client/v2_alpha/test_register.py')
-rw-r--r-- | tests/rest/client/v2_alpha/test_register.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/rest/client/v2_alpha/test_register.py b/tests/rest/client/v2_alpha/test_register.py index d4a1d4d50c..77a2923af6 100644 --- a/tests/rest/client/v2_alpha/test_register.py +++ b/tests/rest/client/v2_alpha/test_register.py @@ -427,6 +427,41 @@ class AccountValidityRenewalByEmailTestCase(unittest.HomeserverTestCase): self.assertEqual(len(self.email_attempts), 1) + def test_manual_email_send_expired_account(self): + user_id = self.register_user("kermit", "monkey") + tok = self.login("kermit", "monkey") + + # We need to manually add an email address otherwise the handler will do + # nothing. + now = self.hs.clock.time_msec() + self.get_success( + self.store.user_add_threepid( + user_id=user_id, + medium="email", + address="kermit@example.com", + validated_at=now, + added_at=now, + ) + ) + + # Make the account expire. + self.reactor.advance(datetime.timedelta(days=8).total_seconds()) + + # Ignore all emails sent by the automatic background task and only focus on the + # ones sent manually. + self.email_attempts = [] + + # Test that we're still able to manually trigger a mail to be sent. + request, channel = self.make_request( + b"POST", + "/_matrix/client/unstable/account_validity/send_mail", + access_token=tok, + ) + self.render(request) + self.assertEquals(channel.result["code"], b"200", channel.result) + + self.assertEqual(len(self.email_attempts), 1) + class AccountValidityBackgroundJobTestCase(unittest.HomeserverTestCase): |