Commit e32b2d57 authored by marc duez's avatar marc duez
Browse files

test/ : add unit test for segmenter_page.html controller

parent 2a585eb0
Pipeline #248189 failed with stages
in 45 seconds
import unittest
from gluon.globals import Request, Session, Storage, Response
from gluon.contrib.test_helpers import form_postvars
from gluon import current
class SegmenterController(unittest.TestCase):
def __init__(self, p):
global auth, session, request
unittest.TestCase.__init__(self, p)
def setUp(self):
# Load the to-be-tested file
execfile("applications/vidjil/controllers/", globals())
# set up default session/request/auth/...
global response, session, request, auth
session = Session()
request = Request({})
auth = VidjilAuth(globals(), db)
auth.login_bare("", "123456")
# rewrite info / error functions
# for some reasons we lost them between the testRunner and the testCase but we need them to avoid error so ...
def f(a, **kwargs):
pass = f
log.error = f
log.debug = f
# for defs
current.db = db
current.auth = auth
def testIndex(self):
request.vars['sequences'] = ">plop \nATGTCGTCGTATGCGT"
resp = index()
self.assertTrue("ATGTCGTCGTATGCGT" in resp, "index() did not return the expected sequence analysis")
\ No newline at end of file
......@@ -13,8 +13,10 @@ class DefaultController(unittest.TestCase)
BEWARE that the name is NOT in plural (controllers->Controller)
apt-get install python-pip
pip install unittest2
pip install unittest-xml-reporting
pip install mock
Execute with:
> python -S vidjil -M -R
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment