Download:
child 37:bbce1e45da1e
parent 35:d0d03f67dc1f
36:63c9cb7c6bb8
Anton Shestakov <av6@dwimlabs.net>, Sat, 18 Jun 2016 18:56:12 +0800
tests: mock database to be an in-memory db for tests

2 файлов изменено, 17 вставок(+), 0 удалений(-) [+]
dev-requirements.txt file | annotate | diff | comparison | revisions
tests/test_viewer.py file | annotate | diff | comparison | revisions
--- a/dev-requirements.txt Fri Jun 17 21:23:45 2016 +0800
+++ b/dev-requirements.txt Sat Jun 18 18:56:12 2016 +0800
@@ -1,1 +1,2 @@
+mock==2.0.0
pytest==2.9.2
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test_viewer.py Sat Jun 18 18:56:12 2016 +0800
@@ -0,0 +1,16 @@
+from mock import Mock
+from tornado.testing import AsyncHTTPTestCase
+
+from candolint.models import database, Project, Change, Check
+from viewer import CandolintViewer
+
+
+class ViewerTestCase(AsyncHTTPTestCase):
+ def get_app(self):
+ database.init(':memory:')
+ database.connect()
+ database.create_tables([Project, Change, Check], safe=True)
+ database.init = Mock()
+ database.connect = Mock()
+ database.disconnect = Mock()
+ return CandolintViewer()