From 687fedfffa402e049c59668f2a6248ad2ba17910 Mon Sep 17 00:00:00 2001 From: Christopher Baklid Date: Sun, 20 May 2018 21:11:18 +0200 Subject: Tests directory (#73) moves all tests into a testing directory and splits the tests into separate files --- tests/test_utilities.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 tests/test_utilities.py (limited to 'tests/test_utilities.py') diff --git a/tests/test_utilities.py b/tests/test_utilities.py new file mode 100644 index 00000000..61a480e2 --- /dev/null +++ b/tests/test_utilities.py @@ -0,0 +1,25 @@ +from tests import SiteTest, manager + +class Utilities(SiteTest): + """ Test cases for internal utility code """ + def test_error_view_runtime_error(self): + """ Check that wrong values for error view setup raises runtime error """ + import pysite.base_route + + ev = pysite.base_route.ErrorView() + + with self.assertRaises(RuntimeError): + ev.setup(manager, 'sdfsdf') + + def test_websocket_callback(self): + """ Check that websocket default callbacks work """ + import pysite.websockets + + class TestWS(pysite.websockets.WS): + pass + + try: + TestWS(None).on_message("test") + return False + except NotImplementedError: + return True -- cgit v1.2.3