def test_404(self): """No URL rules defined.""" app = Tipfy() client = app.get_test_client() # Normal mode. response = client.get('/') self.assertEqual(response.status_code, 404) # Debug mode. app.debug = True response = client.get('/') self.assertEqual(response.status_code, 404)
def test_501(self): """Method is not in app.allowed_methods.""" app = Tipfy() client = app.get_test_client() # Normal mode. response = client.open('/', method='CONNECT') self.assertEqual(response.status_code, 501) # Debug mode. app.debug = True response = client.open('/', method='CONNECT') self.assertEqual(response.status_code, 501)
def test_500(self): """Handler import will fail.""" app = Tipfy(rules=[Rule('/', name='home', handler='non.existent.handler')]) client = app.get_test_client() # Normal mode. response = client.get('/') self.assertEqual(response.status_code, 500) # Debug mode. app.debug = True app.config['tipfy']['enable_debugger'] = False self.assertRaises(ImportError, client.get, '/')
def test_500(self): """Handler import will fail.""" app = Tipfy( rules=[Rule('/', name='home', handler='non.existent.handler')]) client = app.get_test_client() # Normal mode. response = client.get('/') self.assertEqual(response.status_code, 500) # Debug mode. app.debug = True app.config['tipfy']['enable_debugger'] = False self.assertRaises(ImportError, client.get, '/')