def test_showItem1(self): set_cgi('GET', 'id=123') out = MyStdout() self.capture_stdout(out) Runner.scaffold(MockPersistentObject, db, model) self.reset_stdout() self.assertMime('text/html', out) html = '\n'.join(out.content) self.assertTrue(html.find('TODO! read item 123') != -1)
def test_postCreate1(self): set_cgi('POST', '') out = MyStdout() self.capture_stdout(out) Runner.scaffold(MockPersistentObject, db, model) self.reset_stdout() self.assertMime('text/html', out) html = '\n'.join(out.content) self.assertTrue(html.find('TODO! create new item') != -1)
def test_post(self): set_cgi('POST', '') out = MyStdout() self.capture_stdout(out) Runner.run(TestHandler()) self.reset_stdout() self.assertMime('text/plain', out) html = '\n'.join(out.content) self.assertEqual(html, "Content-Type: text/plain\n\n\n\nTEST_POST\n\n")
def test_create(self): set_cgi('GET', 'a=create') out = MyStdout() self.capture_stdout(out) Runner.scaffold(MockPersistentObject, db, model) self.reset_stdout() self.assertMime('text/html', out) html = '\n'.join(out.content) self.assertTrue(html.find('TODO! draw create form') != -1, 'TODO statement not found')
def test_noGETDelete(self): set_cgi('GET', 'a=delete') out = MyStdout() self.capture_stdout(out) Runner.scaffold(MockPersistentObject, db, model) self.reset_stdout() self.assertMime('text/html', out) html = '\n'.join(out.content) self.assertTrue(html.find('NOT IMPLEMENTED') != -1)