try: from local_config import TEST_USER except ImportError: print(''' You have not specified a TEST_USER in local_config.py If you wish to auto-login as a certain user, set TEST_USER in local_config.py Otherwise run webapp.py as opposed to tests/python/webapp.py ''') sys.exit(1) msg = ''' FOR TESTING PURPOSES ONLY! FOR TESTING PURPOSES ONLY! FOR TESTING PURPOSES ONLY! -------------------------- Logging in as: {} -------------------------- FOR TESTING PURPOSES ONLY! FOR TESTING PURPOSES ONLY! FOR TESTING PURPOSES ONLY! '''.format(TEST_USER, indent=4) with patch.object(BaseHandler, '_current_user_cookie') as p: p.return_value = TEST_USER main(modify_text(msg, green))
def run(self): timecollector = TimeCollector() timecollector.start() webapp.main()
def setUp(self): from webapp import main app = main({}) from webtest import TestApp self.testapp = TestApp(app)
def app(db): from webapp import main from webtest import TestApp os.environ['DATABASE_URL'] = TEST_DSN app = main() return TestApp(app)
#!/usr/bin/env python3 """Webapp script for selenium tests.""" import sys import os sys.path.insert(0, os.path.abspath('.')) from dokomoforms.options import parse_options, options parse_options() # Override options set in config.py, local_config.py options.port = 9999 options.schema = 'doko_test' options.debug = True options.demo = False options.https = False options.revisit_url = 'http://localhost:9999/debug/facilities' from webapp import main main()
def data(): form = request.form question = form['query'] answer = webapp.main(question) return render_template("data.html", text=answer)
from webapp import main, modify_text, green try: from local_config import TEST_USER except ImportError: print(''' You have not specified a TEST_USER in local_config.py If you wish to auto-login as a certain user, set TEST_USER in local_config.py Otherwise run webapp.py as opposed to tests/python/webapp.py ''') sys.exit(1) msg = ''' FOR TESTING PURPOSES ONLY! FOR TESTING PURPOSES ONLY! FOR TESTING PURPOSES ONLY! -------------------------- Logging in as: {} -------------------------- FOR TESTING PURPOSES ONLY! FOR TESTING PURPOSES ONLY! FOR TESTING PURPOSES ONLY! '''.format(TEST_USER, indent=4) with patch.object(BaseHandler, '_current_user_cookie') as p: p.return_value = TEST_USER main(modify_text(msg, green))
#!/usr/bin/env python3 """Webapp script for selenium tests.""" import sys import os sys.path.insert(0, os.path.abspath('.')) from dokomoforms.options import parse_options, options parse_options() # Override options set in config.py, local_config.py options.port = 9999 options.schema = 'doko_test' options.debug = True options.demo = False options.https = False options.persona_verification_url = 'http://localhost:9999/debug/persona_verify' options.revisit_url = 'http://localhost:9999/debug/facilities' from webapp import main main()