Skip to content

Commit

Permalink
add default status code
Browse files Browse the repository at this point in the history
  • Loading branch information
yandy committed Oct 31, 2017
1 parent 8134fae commit f24d25a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sea/test/stub.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import grpc


class Context():
def __init__(self):
self.code = None
self.code = grpc.StatusCode.OK
self.details = None
self.metadata = None

Expand Down
3 changes: 3 additions & 0 deletions tests/test_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import grpc

from sea.exceptions import BadRequestException
from sea.test.stub import Context, Stub
from sea.servicer import ServicerMeta
Expand All @@ -19,6 +21,7 @@ def return_normal(self, request, context):
assert stub.ctx.invocation_metadata() == data
res = stub.return_normal(None)
assert res is None
assert stub.ctx.code == grpc.StatusCode.OK
assert stub.ctx.invocation_metadata() is None

res = stub.return_error(None)
Expand Down

0 comments on commit f24d25a

Please sign in to comment.