changeset 5191:17281153a4c0

test_login: Test "Log Out" link
author Søren Løvborg <kwi@kwi.dk>
date Mon, 15 Jun 2015 17:22:17 +0200
parents c082a017b366
children 4c965154a28d
files kallithea/tests/functional/test_login.py
diffstat 1 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/tests/functional/test_login.py	Thu Jun 18 14:54:35 2015 +1200
+++ b/kallithea/tests/functional/test_login.py	Mon Jun 15 17:22:17 2015 +0200
@@ -61,6 +61,22 @@
         self.assertEqual(response.status, '200 OK')
         response.mustcontain('Users Administration')
 
+    def test_logout(self):
+        response = self.app.post(url(controller='login', action='index'),
+                                 {'username': 'test_regular',
+                                  'password': 'test12'})
+
+        # Verify that a login session has been established.
+        response = self.app.get(url(controller='login', action='index'))
+        response = response.follow()
+        self.assertIn('authuser', response.session)
+
+        response.click('Log Out')
+
+        # Verify that the login session has been terminated.
+        response = self.app.get(url(controller='login', action='index'))
+        self.assertNotIn('authuser', response.session)
+
     @parameterized.expand([
           ('data:text/html,<script>window.alert("xss")</script>',),
           ('mailto:test@example.com',),