blob: 8ae464d03e05ca3fc479765b951e5c880be55382 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
from tutorial import models
from tutorial.views.default import my_view
from tutorial.views.notfound import notfound_view
def test_my_view_failure(app_request):
info = my_view(app_request)
assert info.status_int == 500
def test_my_view_success(app_request, dbsession):
model = models.MyModel(name='one', value=55)
dbsession.add(model)
dbsession.flush()
info = my_view(app_request)
assert app_request.response.status_int == 200
assert info['one'].name == 'one'
assert info['project'] == 'myproj'
def test_notfound_view(app_request):
info = notfound_view(app_request)
assert app_request.response.status_int == 404
assert info == {}
|