diff options
| -rw-r--r-- | .gitignore | 4 | ||||
| -rw-r--r-- | README.rst | 11 | ||||
| -rwxr-xr-x | pyactivitypubd | 11 | ||||
| -rw-r--r-- | pyapd/app.py | 14 | ||||
| -rwxr-xr-x | run_tests | 4 | ||||
| -rw-r--r-- | tests/test_app.py | 12 | 
6 files changed, 56 insertions, 0 deletions
| diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e933fda --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.coverage +*.pyc + +.*.sw? @@ -8,6 +8,17 @@ with clients through the ActivityPub c2s protocol.  .. _ActivityPub: https://www.w3.org/TR/activitypub/ +Installation +============ + +Dependencies +------------ + +PyAPD requires the following dependencies and targets their versions as +available in Debian buster. + +* `Tornado <https://www.tornadoweb.org>` +  License  ======= diff --git a/pyactivitypubd b/pyactivitypubd new file mode 100755 index 0000000..d89dd96 --- /dev/null +++ b/pyactivitypubd @@ -0,0 +1,11 @@ +#!/usr/bin/env python3 + +import tornado.ioloop + +from pyapd import app + + +if __name__ == "__main__": +    apd = app.App() +    apd.listen(8888) +    tornado.ioloop.IOLoop.current().start() diff --git a/pyapd/app.py b/pyapd/app.py new file mode 100644 index 0000000..b470688 --- /dev/null +++ b/pyapd/app.py @@ -0,0 +1,14 @@ +import tornado.web + + +class RootHandler(tornado.web.RequestHandler): +    def get(self): +        self.write("Hello World") + + +class App(tornado.web.Application): +    def __init__(self, *args, **kw): +        urls = [ +            (r'/', RootHandler), +            ] +        super().__init__(urls, *args, **kw) diff --git a/run_tests b/run_tests new file mode 100755 index 0000000..b609f1f --- /dev/null +++ b/run_tests @@ -0,0 +1,4 @@ +#!/bin/sh + +nose2-3 --with-coverage --coverage-report=term +flake8 . diff --git a/tests/test_app.py b/tests/test_app.py new file mode 100644 index 0000000..a2ff27a --- /dev/null +++ b/tests/test_app.py @@ -0,0 +1,12 @@ +from tornado.testing import AsyncHTTPTestCase + +from pyapd import app + + +class TestApp(AsyncHTTPTestCase): +    def get_app(self, *args, **kw): +        return app.App() + +    def test_root(self): +        res = self.fetch('/') +        self.assertEqual(res.code, 200) | 
