Skip to content
This repository has been archived by the owner on Mar 20, 2018. It is now read-only.

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
geigerj committed Sep 19, 2016
1 parent f0681e5 commit 69efb57
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/test_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,16 @@ def test_creates_a_stub_ok_with_given_auth_func(self, auth, dummy_chan,
_fake_create_stub, self.FAKE_SERVICE_PATH, self.FAKE_PORT,
metadata_transformer=lambda x: tuple())
self.assertFalse(auth.called)


class TestErrors(unittest2.TestCase):
class MyError(grpc.RpcError):
def code(self):
return grpc.StatusCode.UNKNOWN

def test_exc_to_code(self):
code = grpc.exc_to_code(TestErrors.MyError())
self.assertEqual(code, grpc.StatusCode.UNKNOWN)
self.assertEqual(code, grpc.STATUS_CODE_NAMES['UNKNOWN'])
self.assertIsNone(grpc.exc_to_code(Exception))
self.assertIsNone(grpc.exc_to_code(grpc.RpcError()))

0 comments on commit 69efb57

Please sign in to comment.