Tests pass now.
This commit is contained in:
parent
961db8ad72
commit
8fa5e32d9a
24 changed files with 421 additions and 530 deletions
|
|
@ -1,36 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Blueprint Example Tests
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
Tests the Blueprint example app
|
||||
"""
|
||||
import blueprintexample
|
||||
import unittest
|
||||
|
||||
|
||||
class BlueprintExampleTestCase(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.app = blueprintexample.app.test_client()
|
||||
|
||||
def test_urls(self):
|
||||
r = self.app.get('/')
|
||||
self.assertEquals(r.status_code, 200)
|
||||
|
||||
r = self.app.get('/hello')
|
||||
self.assertEquals(r.status_code, 200)
|
||||
|
||||
r = self.app.get('/world')
|
||||
self.assertEquals(r.status_code, 200)
|
||||
|
||||
#second blueprint instance
|
||||
r = self.app.get('/pages/hello')
|
||||
self.assertEquals(r.status_code, 200)
|
||||
|
||||
r = self.app.get('/pages/world')
|
||||
self.assertEquals(r.status_code, 200)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
33
examples/blueprintexample/test_blueprintexample.py
Normal file
33
examples/blueprintexample/test_blueprintexample.py
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Blueprint Example Tests
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
Tests the Blueprint example app
|
||||
"""
|
||||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue