# -*- coding: utf-8 -*- import sys sys.path.append('./vendor') sys.path.append('./lib') import juno juno.init() from controller import session, signup, main #from controller import message, follow #from controller import test_user # juno.run_with_profiler() juno.run()
@juno.get('/5/') def x5(web): juno.content_type('text/json') @juno.get('/6/') def x6(web): return str(web.input()) @juno.get('/7/') def x7(web): return str(web.input()) application = juno.run() """ -------------------------------------- """ """ End Application Code / Start Test Code """ """ -------------------------------------- """ import unittest from client import Client client = Client(application) class ResponseTest(unittest.TestCase): """Test basic responses - status codes, headers, bodies. """ def test200StatusCode(self): """Juno should send a 200 by default""" status, _, _ = client.request('/1/') self.assertEqual(status, '200 OK')
@juno.get('/3/') def x3(web): juno.status(500) @juno.get('/4/') def x4(web): return @juno.get('/5/') def x5(web): juno.content_type('text/json') @juno.get('/6/') def x6(web): return str(web.input()) @juno.get('/7/') def x7(web): return str(web.input()) application = juno.run() """ -------------------------------------- """ """ End Application Code / Start Test Code """ """ -------------------------------------- """ import unittest from client import Client client = Client(application) class ResponseTest(unittest.TestCase): """Test basic responses - status codes, headers, bodies. """ def test200StatusCode(self): """Juno should send a 200 by default""" status, _, _ = client.request('/1/') self.assertEqual(status, '200 OK')
#!/usr/bin/env python3.0 from juno import init, run init({'static_url': '/(s/)?(?P<file>(?<=s/).*|(css|img|js|lib)/.*)', '500_traceback': True, 'use_templates': True, 'bind_address': '', 'use_db': True, 'db_location': "db.sqlite", 'template_kwargs': {'extensions': ["jinja2.ext.do","jinja2.ext.loopcontrols"]} }) import inc.routes run()