Skip to content

Commit

Permalink
fixed test and improved exception hook
Browse files Browse the repository at this point in the history
  • Loading branch information
josephmancuso committed Jun 7, 2018
1 parent f39a450 commit bd714a0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion masonite/providers/StatusCodeProvider.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
class ServerErrorExceptionHook:

def load(self, app):
if app.make('Application').DEBUG == 'True':
if app.make('Application').DEBUG == 'True' or app.make('Application').DEBUG == True:
return

request = app.make('Request').status('500 Internal Server Error')
Expand Down
6 changes: 3 additions & 3 deletions tests/providers/test_statuscode_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def test_provider_returns_none_on_200_OK(self):
assert self.provider is None

class MockApplicationConfig:
DEBUG = True
DEBUG = 'True'

class TestServerErrorExceptionHook:

Expand All @@ -35,8 +35,8 @@ def setup_method(self):
self.app.bind('View', self.app.make('ViewClass').render)
self.hook = ServerErrorExceptionHook().load(self.app)

def test_response_is_set(self):
assert '500 Internal Server Error' in self.app.make('Response')
def test_response_is_set_when_app_debug_is_true(self):
assert self.hook is None

def test_no_response_set_when_app_debug_is_false(self):
application = MockApplicationConfig
Expand Down

0 comments on commit bd714a0

Please sign in to comment.