-
-
Notifications
You must be signed in to change notification settings - Fork 195
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
dbc2a25
commit 48b684a
Showing
4 changed files
with
48 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import pytest | ||
|
||
from tavern._core import exceptions | ||
from tavern._core.schema.extensions import ( | ||
validate_grpc_status_is_valid_or_list_of_names as validate_grpc, | ||
) | ||
|
||
|
||
class TestGrpcCodes: | ||
@pytest.mark.parametrize("code", ("UNAVAILABLE", "unavailable", "ok", 14, 0)) | ||
def test_validate_grpc_valid_status(self, code): | ||
assert True is validate_grpc(code, None, None) | ||
assert True is validate_grpc([code], None, None) | ||
|
||
@pytest.mark.parametrize("code", (-1, "fo", "J", {"status": "OK"})) | ||
def test_validate_grpc_invalid_status(self, code): | ||
with pytest.raises(exceptions.BadSchemaError): | ||
assert False is validate_grpc(code, None, None) | ||
|
||
with pytest.raises(exceptions.BadSchemaError): | ||
assert False is validate_grpc([code], None, None) |
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