Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_app_simple_bind_init(self):
app = App()
req = Request()
app.simple(req)
self.assertEqual(app.providers, {Request: req})
def test_gets_input_with_all_request_methods(self):
app = App()
wsgi_request['QUERY_STRING'] = 'hey=test'
request_class = Request(wsgi_request)
app.bind('Request', request_class)
request = app.make('Request').load_app(app)
request.environ['REQUEST_METHOD'] = 'GET'
self.assertEqual(request.input('hey'), 'test')
request.environ['REQUEST_METHOD'] = 'POST'
self.assertEqual(request.input('hey'), 'test')
request.environ['REQUEST_METHOD'] = 'PUT'
self.assertEqual(request.input('hey'), 'test')
request.environ['REQUEST_METHOD'] = 'PATCH'
self.assertEqual(request.input('hey'), 'test')
request.environ['REQUEST_METHOD'] = 'DELETE'
def setUp(self):
from masonite.request import Request
self.app = App()
self.app.bind('Request', Request().load_app(self.app))
self.provider = ValidationProvider().load_app(self.app)
self.provider.register()
self.app.resolve(self.provider.boot)
def setUp(self):
self.app = App()
self.app.bind('Request', Request(None))
self.app.bind('MockObject', MockObject)
self.app.bind('GetObject', GetObject)
self.app.bind('Container', self.app)
def test_request_sets_request_method(self):
wsgi = generate_wsgi()
wsgi['QUERY_STRING'] = '__method=PUT'
request = Request(wsgi)
assert request.has('__method')
self.assertEqual(request.input('__method'), 'PUT')
self.assertEqual(request.get_request_method(), 'PUT')
def test_request_view_helper_is_view_class(self):
self.assertIsInstance(self.view._shared['request'](), Request)
def test_compact_throws_exceptions(self):
r = Request(None)
request = r
with self.assertRaises(AmbiguousError):
compact(request)
def test_works_with_classes(self):
request = Request(None)
self.assertIn('request', compact(request))