-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Showing
4 changed files
with
59 additions
and
19 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
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
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
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,42 @@ | ||
import pytest | ||
|
||
from esmerald import Gateway, ImproperlyConfigured, Include, get | ||
|
||
|
||
@get() | ||
async def home() -> None: | ||
"""""" | ||
|
||
|
||
gateway = Gateway(handler=home) | ||
|
||
|
||
route_patterns = [Gateway(handler=home)] | ||
|
||
|
||
def test_raise_error_namespace_and_routes(): | ||
with pytest.raises(ImproperlyConfigured): | ||
Include(namespace="test", routes=[gateway]) | ||
|
||
|
||
@pytest.mark.parametrize("arg", [gateway, 2, get]) | ||
def test_raise_error_namespace(arg): | ||
with pytest.raises(ImproperlyConfigured): | ||
Include(namespace=arg) | ||
|
||
|
||
@pytest.mark.parametrize("arg", [gateway, 2, get]) | ||
def test_raise_error_pattern(arg): | ||
with pytest.raises(ImproperlyConfigured): | ||
Include(pattern=arg) | ||
|
||
|
||
def test_raise_error_pattern_and_routes(): | ||
with pytest.raises(ImproperlyConfigured): | ||
Include(pattern="test", routes=[gateway]) | ||
|
||
|
||
def test_namespace_include_routes(): | ||
include = Include(namespace="tests.routing.test_include_errors") | ||
|
||
assert len(include.routes) == 1 |