Repository URL to install this package:
|
Version:
1.5.7 ▾
|
import unittest
from pyramid import testing
class TutorialViewTests(unittest.TestCase):
def setUp(self):
self.config = testing.setUp()
def tearDown(self):
testing.tearDown()
def test_home(self):
from .views import TutorialViews
request = testing.DummyRequest()
inst = TutorialViews(request)
response = inst.home()
self.assertEqual('Home View', response['name'])
def test_hello(self):
from .views import TutorialViews
request = testing.DummyRequest()
inst = TutorialViews(request)
response = inst.hello()
self.assertEqual('Hello View', response['name'])
class TutorialFunctionalTests(unittest.TestCase):
def setUp(self):
from tutorial import main
app = main({})
from webtest import TestApp
self.testapp = TestApp(app)
def test_home(self):
res = self.testapp.get('/', status=200)
self.assertIn(b'<h1>Hi Home View', res.body)
def test_hello(self):
res = self.testapp.get('/howdy', status=200)
self.assertIn(b'<h1>Hi Hello View', res.body)