125:751f50b9b5fa
Anton Shestakov <av6@dwimlabs.net>, Thu, 07 Jul 2016 14:24:22 +0800
viewer: remove special case for cleanup task collapser Now that final "job finished" metadata line is not in any task, cleanup is empty and won't get the collapser naturally.

next change 127:837ecaf010dc
previous change 100:403f302df870

tests/test_viewer.py

Permissions: -rw-r--r--

Other formats: Feeds:
from mock import Mock
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, Change, Check
from viewer import CandolintViewer
def setup_module():
database.init(':memory:')
database.connect()
database.create_tables([Project, Change, Check], safe=True)
database.init = Mock()
database.connect = Mock()
database.close = Mock()
with database.transaction():
Project.create(
url='https://example.com/alice/hello-world',
domain='example.com',
user='alice',
name='hello-world')
def test_get_project_or_404():
with raises(HTTPError) as error:
get_project_or_404('butt.cloud', 'cyber', 'wizard-attack')
assert error.value.status_code == 404
project = get_project_or_404('example.com', 'alice', 'hello-world')
assert project.id is not None
assert project.url == 'https://example.com/alice/hello-world'
class ViewerTestCase(AsyncHTTPTestCase):
def get_app(self):
return CandolintViewer()
def test_index(self):
response = self.fetch('/')
assert response.code == 200
assert 'online linter' in response.body
def test_404(self):
response = self.fetch('/nobodyhere')
assert response.code == 404
assert 'online linter' in response.body