mirror of
https://github.com/zulip/zulip.git
synced 2025-11-18 04:43:58 +00:00
test_helpers: Require that login calls actually succeed.
This caught several bugs where test code wasn't doing what it's author intended.
This commit is contained in:
@@ -256,10 +256,13 @@ class AuthedTestCase(TestCase):
|
||||
return self.client.post('/accounts/login/',
|
||||
{'username': email, 'password': password})
|
||||
|
||||
def login(self, email, password=None):
|
||||
def login(self, email, password=None, fails=False):
|
||||
if password is None:
|
||||
password = initial_password(email)
|
||||
self.client.login(username=email, password=password)
|
||||
if not fails:
|
||||
self.assertTrue(self.client.login(username=email, password=password))
|
||||
else:
|
||||
self.assertFalse(self.client.login(username=email, password=password))
|
||||
|
||||
def register(self, username, password, domain="zulip.com"):
|
||||
# type: (text_type, text_type, text_type) -> HttpResponse
|
||||
|
||||
Reference in New Issue
Block a user