Created
June 20, 2012 21:39
-
-
Save jayd3e/2962406 to your computer and use it in GitHub Desktop.
Pyramid Testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TestBlogHandler(unittest.TestCase): | |
def setUp(self): | |
initializeDb(engine(TestConfig)) | |
self.config = testing.setUp() | |
self.request = testing.DummyRequest() | |
self.request.environ['PATH_INFO'] = '/blog' | |
def testBlogHandlerInit(self): | |
handler = BlogHandler(self.request) | |
self.assertIsNot(handler.request, None) | |
self.assertEqual(handler.here, '/blog') | |
self.assertEqual(handler.logged_in, None) | |
def testBlogHandlerIndex(self): | |
handler = BlogHandler(self.request) | |
response = handler.index() | |
self.assertIn('here', response) | |
self.assertIn('title', response) | |
self.assertIn('logged_in', response) | |
self.assertIn('posts', response) | |
def testBlogHandlerHackeyes(self): | |
handler = BlogHandler(self.request) | |
response = handler.hackeyes() | |
self.assertEqual(response, {}) | |
def tearDown(self): | |
testing.tearDown() | |
Session().close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment