-
Notifications
You must be signed in to change notification settings - Fork 0
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
3 changed files
with
85 additions
and
94 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 |
---|---|---|
@@ -1,18 +1,21 @@ | ||
import pytest | ||
from types import FunctionType | ||
|
||
from rmediator.decorators import request | ||
|
||
|
||
class TestRequest: | ||
def test__request__invalid_no_response__raises_value_error(self): | ||
with pytest.raises(AttributeError): | ||
|
||
@request | ||
class InvalidRequest: | ||
pass | ||
def test__request__invalid_registration_no_response__raises_value_error(self): | ||
@request | ||
class InvalidRequest: | ||
pass | ||
|
||
def test__request__valid(self): | ||
assert type(InvalidRequest) is FunctionType | ||
assert type(InvalidRequest) is not type | ||
|
||
@request | ||
def test__request__valid_registration__successful(self): | ||
@request(str) | ||
class ValidRequest: | ||
response = str | ||
pass | ||
|
||
assert ValidRequest._response is str | ||
assert hasattr(ValidRequest, "_rmediator_decorated_request") is True |
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