Пример #1
0
 def testBasicCallWithClass(self):
     stub = LocalService.Stub(transport.LocalTransport(LocalService))
     response = stub.call_method(content='Hello')
     self.assertEquals(
         SimpleResponse(content='Hello',
                        factory_value='default',
                        remote_host=os.uname()[1],
                        remote_address='127.0.0.1',
                        server_host=os.uname()[1],
                        server_port=-1), response)
Пример #2
0
 def testApplicationError(self):
     stub = LocalService.Stub(transport.LocalTransport(LocalService))
     self.assertRaisesWithRegexpMatch(remote.ApplicationError, 'App error',
                                      stub.raise_application_error)
Пример #3
0
 def testUnexpectedError(self):
     stub = LocalService.Stub(transport.LocalTransport(LocalService))
     self.assertRaisesWithRegexpMatch(
         remote.ServerError, 'Unexpected error RequestError: Huh?',
         stub.raise_unexpected)
Пример #4
0
 def testTotallyUnexpectedError(self):
     stub = LocalService.Stub(transport.LocalTransport(LocalService))
     self.assertRaisesWithRegexpMatch(remote.ServerError,
                                      'Unexpected error TypeError: Kablam',
                                      stub.raise_totally_unexpected)