tests: Limit email-based logins.

We now have this API...

If you really just need to log in
and not do anything with the actual
user:

    self.login('hamlet')

If you're gonna use the user in the
rest of the test:

    hamlet = self.example_user('hamlet')
    self.login_user(hamlet)

If you are specifically testing
email/password logins (used only in 4 places):

    self.login_by_email(email, password)

And for failures uses this (used twice):

    self.assert_login_failure(email)
This commit is contained in:
Steve Howell
2020-03-06 17:40:46 +00:00
committed by Tim Abbott
parent c235333041
commit 1b16693526
55 changed files with 1071 additions and 1149 deletions

View File

@@ -74,8 +74,7 @@ class AdminNotifyHandlerTest(ZulipTestCase):
handler.emit(record)
def simulate_error(self) -> logging.LogRecord:
email = self.example_email('hamlet')
self.login(email)
self.login('hamlet')
with patch("zerver.decorator.rate_limit") as rate_limit_patch:
rate_limit_patch.side_effect = capture_and_throw
result = self.client_get("/json/users")