tests: Add wrapper for client.logout in ZulipTestCase.

In this commit we add a logout wrapper so as to enable developers
to just do self.logout instead of doing a post request at API
endpoint for logout. This is achieved by adding a wrapper function
for the Django's client.logout contained in TestCase. We add this
by extending ZulipTestCase to have a logout function.
This commit is contained in:
Aditya Bansal
2017-04-18 06:53:32 +05:30
committed by Tim Abbott
parent cf001876d4
commit bdcddd35d0
5 changed files with 18 additions and 12 deletions

View File

@@ -223,6 +223,10 @@ class ZulipTestCase(TestCase):
else:
self.assertFalse(self.client.login(username=email, password=password))
def logout(self):
# type: () -> None
self.client.logout()
def register(self, email, password):
# type: (Text, Text) -> HttpResponse
self.client_post('/accounts/home/', {'email': email})