Download:
child 166:b55a7bba94ec
parent 164:3c8449c7f119
165:7d1baf2f0b87
Anton Shestakov <av6@dwimlabs.net>, Tue, 19 Jul 2016 22:22:48 +0800
tests: add sample change and check to viewer tests

1 файлов изменено, 24 вставок(+), 2 удалений(-) [+]
tests/test_viewer.py file | annotate | diff | comparison | revisions
--- a/tests/test_viewer.py Tue Jul 19 20:51:01 2016 +0800
+++ b/tests/test_viewer.py Tue Jul 19 22:22:48 2016 +0800
@@ -1,19 +1,39 @@
+from datetime import datetime
+
from pytest import raises
from tornado.web import HTTPError
from tornado.testing import AsyncHTTPTestCase
from candolint.handlers import get_project_or_404
-from candolint.models import database, Project
+from candolint.models import database, Project, Change, Check
from viewer import CandolintViewer
def setup_module():
with database.transaction():
- Project.create(
+ project = Project.create(
url='https://example.com/alice/test-viewer',
domain='example.com',
user='alice',
name='test-viewer')
+ change = Change.create(
+ rev=42,
+ node='92cfceb39d57d914ed8b14d0e37643de0797ae56',
+ branch='default',
+ date='2016-07-19 22:23 +0800',
+ author='alice',
+ message='component: do a thing',
+ project=project)
+ Check.create(
+ ordinal=Check.get_next_ordinal(project),
+ errors=1,
+ warnings=1,
+ lines='[]',
+ success=True,
+ started=datetime.now(),
+ finished=datetime.now(),
+ change=change,
+ project=project)
def test_get_project_or_404():
@@ -34,6 +54,8 @@
response = self.fetch('/')
assert response.code == 200
assert 'online linter' in response.body
+ assert '1 error' in response.body
+ assert '1 warning' in response.body
def test_404(self):
response = self.fetch('/nobodyhere')