Skip to content

Commit

Permalink
Adds test for session timeout.
Browse files Browse the repository at this point in the history
  • Loading branch information
rtibbles committed Jun 12, 2014
1 parent b550334 commit 77e345a
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions kalite/distributed/tests/browser_tests/distributed.py
Expand Up @@ -13,6 +13,7 @@
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.utils import unittest
from django.test.utils import override_settings
from django.utils.translation import ugettext as _

from .base import KALiteDistributedBrowserTestCase, KALiteDistributedWithFacilityBrowserTestCase
Expand Down Expand Up @@ -313,3 +314,28 @@ def test_add_teacher_form(self):
def test_add_group_form(self):
self.browser_login_admin()
self.empty_form_test(url=self.reverse("add_group"), submission_element_id="id_name")


@override_settings(SESSION_IDLE_TIMEOUT=1)
class TestSessionTimeout(KALiteDistributedWithFacilityBrowserTestCase):
"""
Test webpage for timing out user sessions
"""

def test_facility_user_logout_after_interval(self):
student_username = 'test_student'
student_password = 'socrates'
self.student = self.create_student()
self.browser_login_student(student_username, student_password)
time.sleep(3)
self.browse_to(self.reverse("exercise_dashboard"))
self.browser_check_django_message(message_type="error", contains="Your session has been timed out.")

# Skip this test as currently fails due to unrelated reasons.
# Main functionality is to enforce student log out.
# def test_admin_user_logout_after_interval(self):
# # Login as admin
# self.browser_login_admin()
# time.sleep(3)
# self.browse_to(self.reverse("homepage"))
# self.browser_check_django_message(message_type="error", contains="Your session has been timed out.")

0 comments on commit 77e345a

Please sign in to comment.