Exemple #1
0
 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']
Exemple #4
0
 def boot(self):
     Application.bind('env', self.env)
     Application.bind('config', config)
     Application.bind('response', Response(self.response))
Exemple #5
0
 def method():
     return Application.get('env')['REQUEST_METHOD']
Exemple #6
0
 def uri():
     return Application.get('env')['PATH_INFO'].strip('/')
Exemple #7
0
 def test_key_value_can_bind_to_container(self):
     Application.bind('config', "data")
     assert Application.get('config') == 'data'
Exemple #8
0
 def test_bind_function(self):
     Application.bind('config', config)
     assert Application.get('config')['basePath'] == '/path'
Exemple #9
0
 def test_expection_is_thrown_if_undefined_key_is_asked(self):
     with pytest.raises(Exception):
         Application.get('nokey')