Anton Shestakov <av6@dwimlabs.net>, Thu, 14 Jul 2016 17:04:03 +0800
tests: test parsing urls with "directories"
tests/test_viewer.py
Permissions: -rw-r--r--
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 viewer import CandolintViewer with database.transaction(): url='https://example.com/alice/test-viewer', 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', 'test-viewer') assert project.id is not None assert project.url == 'https://example.com/alice/test-viewer' class ViewerTestCase(AsyncHTTPTestCase): response = self.fetch('/') assert response.code == 200 assert 'online linter' in response.body response = self.fetch('/nobodyhere') assert response.code == 404 assert 'online linter' in response.body