def view(self, name, data=None): template = self.env.get_template(name + '.html') data = template.render(data=data) return Application.get('response').sendResponse(data, '200')
def contact(self): return Application.get('response').sendResponse( '<h1>This is html elements.</h1>', '200')
def test_default_database_config(self): Application.bind('database', database) assert Application.get('database')['default'] == database['default']
def boot(self): Application.bind('env', self.env) Application.bind('config', config) Application.bind('response', Response(self.response))
def method(): return Application.get('env')['REQUEST_METHOD']
def uri(): return Application.get('env')['PATH_INFO'].strip('/')
def test_key_value_can_bind_to_container(self): Application.bind('config', "data") assert Application.get('config') == 'data'
def test_bind_function(self): Application.bind('config', config) assert Application.get('config')['basePath'] == '/path'
def test_expection_is_thrown_if_undefined_key_is_asked(self): with pytest.raises(Exception): Application.get('nokey')