2014-09-01 03:56:15 +08:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
"""
|
2018-02-09 02:57:40 +08:00
|
|
|
Blueprint Example Tests
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~
|
2014-09-01 03:56:15 +08:00
|
|
|
|
2018-02-09 02:57:40 +08:00
|
|
|
:copyright: © 2010 by the Pallets team.
|
|
|
|
:license: BSD, see LICENSE for more details.
|
2014-09-01 03:56:15 +08:00
|
|
|
"""
|
2018-02-09 02:57:40 +08:00
|
|
|
|
2014-09-01 03:56:15 +08:00
|
|
|
import pytest
|
|
|
|
|
|
|
|
import blueprintexample
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
|
|
|
def client():
|
|
|
|
return blueprintexample.app.test_client()
|
|
|
|
|
|
|
|
|
|
|
|
def test_urls(client):
|
|
|
|
r = client.get('/')
|
|
|
|
assert r.status_code == 200
|
|
|
|
|
|
|
|
r = client.get('/hello')
|
|
|
|
assert r.status_code == 200
|
|
|
|
|
|
|
|
r = client.get('/world')
|
|
|
|
assert r.status_code == 200
|
|
|
|
|
|
|
|
# second blueprint instance
|
|
|
|
r = client.get('/pages/hello')
|
|
|
|
assert r.status_code == 200
|
|
|
|
|
|
|
|
r = client.get('/pages/world')
|
|
|
|
assert r.status_code == 200
|