38:4326af080387
Anton Shestakov <av6@dwimlabs.net>, Sat, 18 Jun 2016 22:30:42 +0800
viewer: get_or_404() to raise 404 (instead of 500) when model doesn't exist

next change 39:81920cb8753b
previous change 37:bbce1e45da1e

tests/test_viewer.py

Permissions: -rw-r--r--

Other formats: Feeds:
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()
def test_index(self):
response = self.fetch('/')
assert response.code == 200
def test_404(self):
response = self.fetch('/nobodyhere')
assert response.code == 404