diff options
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | cherry_lesana/__init__.py | 1 | ||||
-rw-r--r-- | cherry_lesana/app.py | 13 | ||||
-rwxr-xr-x | clesana | 16 | ||||
-rwxr-xr-x | run_tests | 5 | ||||
-rw-r--r-- | tests/test_views.py | 15 |
6 files changed, 54 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..da71240 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +__pycache__ +*.pyc +.cache +.*.sw? diff --git a/cherry_lesana/__init__.py b/cherry_lesana/__init__.py new file mode 100644 index 0000000..d0f067c --- /dev/null +++ b/cherry_lesana/__init__.py @@ -0,0 +1 @@ +from .app import App diff --git a/cherry_lesana/app.py b/cherry_lesana/app.py new file mode 100644 index 0000000..4ab7672 --- /dev/null +++ b/cherry_lesana/app.py @@ -0,0 +1,13 @@ + +import cherrypy + + +class App: + """ + """ + + @cherrypy.expose + def index(self): + cherrypy.log('asd') + return "Hello World" + @@ -0,0 +1,16 @@ +#!/usr/bin/env python3 + +import cherrypy + +import cherry_lesana as cl + +def main(): + # TODO: read config from a file or something + config = { + '/': { + }, + } + cherrypy.quickstart(cl.App(), '/', config) + +if __name__ == '__main__': + main() diff --git a/run_tests b/run_tests new file mode 100755 index 0000000..ad9eb3d --- /dev/null +++ b/run_tests @@ -0,0 +1,5 @@ +#!/bin/sh + +python3 -m pytest -s +pyflakes3 . +pycodestyle . diff --git a/tests/test_views.py b/tests/test_views.py new file mode 100644 index 0000000..9c0c471 --- /dev/null +++ b/tests/test_views.py @@ -0,0 +1,15 @@ +import cherrypy + +from cherrypy.test import helper + +from cherry_lesana import App + + +class TestViews(helper.CPWebCase): + def setup_server(): + cherrypy.tree.mount(App()) + setup_server = staticmethod(setup_server) + + def test_root(self): + self.getPage('/') + self.assertStatus(200) |