def testURLForWithAnchro(self): app = shimehari.Shimehari(__name__) def index(): return '42' app.router = shimehari.Router([Rule('/', endpoint='index', methods=['GET'])]) app.controllers['index'] = index with app.testRequestContext(): self.assertEqual(shimehari.urlFor('index', _anchor='x y'), '/#x%20y')
def testGenerateURL(self): ConfigManager.addConfig(testConfig) app = shimehari.Shimehari(__name__) def index(*args, **kwargs): return 'index' app.router = shimehari.Router([Rule('/', endpoint='index', methods=['GET'])]) with app.appContext(): rv = shimehari.urlFor('index') self.assertEqual(rv, 'https://localhost/')
def testGenerateURL(self): ConfigManager.addConfig(testConfig) app = shimehari.Shimehari(__name__) def index(*args, **kwargs): return "index" app.router = shimehari.Router([Rule("/", endpoint="index", methods=["GET"])]) with app.appContext(): rv = shimehari.urlFor("index") self.assertEqual(rv, "https://localhost/")
def testGenerateURL(self): ConfigManager.addConfig(testConfig) app = shimehari.Shimehari(__name__) def index(*args, **kwargs): return 'index' app.router = shimehari.Router( [Rule('/', endpoint='index', methods=['GET'])]) with app.appContext(): rv = shimehari.urlFor('index') self.assertEqual(rv, 'https://localhost/')
def testURLForWithAnchro(self): app = shimehari.Shimehari(__name__) def index(): return '42' app.router = shimehari.Router( [Rule('/', endpoint='index', methods=['GET'])]) app.controllers['index'] = index with app.testRequestContext(): self.assertEqual(shimehari.urlFor('index', _anchor='x y'), '/#x%20y')
def testRaiseErrorWithoutContext(self): with self.assertRaises(RuntimeError): shimehari.urlFor("index")
def testRaiseErrorGenerateURLRequireServerName(self): app = shimehari.Shimehari(__name__) app.config["SERVER_NAME"] = None with app.appContext(): with self.assertRaises(RuntimeError): shimehari.urlFor("index")
def testRaiseErrorWithoutContext(self): with self.assertRaises(RuntimeError): shimehari.urlFor('index')
def testRaiseErrorGenerateURLRequireServerName(self): app = shimehari.Shimehari(__name__) app.config['SERVER_NAME'] = None with app.appContext(): with self.assertRaises(RuntimeError): shimehari.urlFor('index')