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 dbf531f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/test_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,14 @@ 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'])

0 comments on commit dbf531f

Please sign in to comment.