Skip to content

Commit

Permalink
Added mostly meaningless tests of demo mode
Browse files Browse the repository at this point in the history
  • Loading branch information
vr2262 committed Jan 19, 2016
1 parent bbdd29f commit 4adeda2
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion tests/python/test_demo_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

utils = (setUpModule, tearDownModule)

import dokomoforms.handlers
from dokomoforms.models import Administrator
from dokomoforms.options import options

Expand All @@ -20,7 +21,26 @@ def get_app(self):
self.app = Application(self.session, options=options)
return self.app

def test_logging_in_creates_user(self):
def test_logging_in_creates_user_no_https(self):
dokomoforms.handlers.demo.options.https = False
no_user = (
self.session
.query(count(Administrator.id))
.filter_by(name='demo_user')
.scalar()
)
self.assertEqual(no_user, 0)
self.fetch('/demo/login', _logged_in_user=None)
user = (
self.session
.query(count(Administrator.id))
.filter_by(name='demo_user')
.scalar()
)
self.assertEqual(user, 1)

def test_logging_in_creates_user_https(self):
dokomoforms.handlers.demo.options.https = True
no_user = (
self.session
.query(count(Administrator.id))
Expand Down

0 comments on commit 4adeda2

Please sign in to comment.