-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f34fed0
commit 26ce790
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from masonite.app import App | ||
from masonite.view import View | ||
from masonite.exception_handler import ExceptionHandler | ||
import pytest | ||
from masonite.exceptions import MissingContainerBindingNotFound | ||
|
||
class ApplicationMock: | ||
DEBUG = True | ||
|
||
class StorageMock: | ||
STATICFILES = {} | ||
|
||
container = App() | ||
container.bind('Application', ApplicationMock) | ||
container.bind('View', View(container).render) | ||
container.bind('Storage', StorageMock) | ||
container.bind('ExceptionHandler', ExceptionHandler(container)) | ||
|
||
def test_exception_renders_view(): | ||
with pytest.raises(MissingContainerBindingNotFound): | ||
assert container.make('ExceptionHandler').load_exception(KeyError) | ||
|
||
|
||
def test_exception_raises_exception(): | ||
container.make('Application').DEBUG = False | ||
with pytest.raises(KeyError): | ||
assert container.make('ExceptionHandler').load_exception(KeyError) |