Exemplo n.º 1
0
    def testDescribe(self):
        class Request1(messages.Message):
            pass

        class Response1(messages.Message):
            pass

        class Request2(messages.Message):
            pass

        class Response2(messages.Message):
            pass

        class MyService(remote.Service):
            @remote.method(Request1, Response1)
            def method1(self, request):
                pass

            @remote.method(Request2, Response2)
            def method2(self, request):
                pass

        expected = descriptor.ServiceDescriptor()
        expected.name = 'MyService'
        expected.methods = []

        expected.methods.append(descriptor.describe_method(MyService.method1))
        expected.methods.append(descriptor.describe_method(MyService.method2))

        described = descriptor.describe_service(MyService)
        described.check_initialized()
        self.assertEquals(expected, described)
  def testDescribe(self):
    class Request1(messages.Message):
      pass

    class Response1(messages.Message):
      pass

    class Request2(messages.Message):
      pass

    class Response2(messages.Message):
      pass

    class MyService(remote.Service):

      @remote.method(Request1, Response1)
      def method1(self, request):
        pass

      @remote.method(Request2, Response2)
      def method2(self, request):
        pass

    expected = descriptor.ServiceDescriptor()
    expected.name = 'MyService'
    expected.methods = []

    expected.methods.append(descriptor.describe_method(MyService.method1))
    expected.methods.append(descriptor.describe_method(MyService.method2))

    described = descriptor.describe_service(MyService)
    described.check_initialized()
    self.assertEquals(expected, described)
    def testMethod(self):
        class Param(messages.Message):
            pass

        class Service(remote.Service):
            @remote.method(Param, Param)
            def fn(self):
                return Param()

        self.assertEquals(descriptor.describe_method(Service.fn), descriptor.describe(Service.fn))
Exemplo n.º 4
0
    def testMethod(self):
        class Param(messages.Message):
            pass

        class Service(remote.Service):
            @remote.method(Param, Param)
            def fn(self):
                return Param()

        self.assertEquals(descriptor.describe_method(Service.fn),
                          descriptor.describe(Service.fn))
  def testDescribe(self):
    class Request(messages.Message):
      pass

    class Response(messages.Message):
      pass

    @remote.method(Request, Response)
    def remote_method(request):
      pass

    module_name = test_util.get_module_name(DescribeMethodTest)
    expected = descriptor.MethodDescriptor()
    expected.name = 'remote_method'
    expected.request_type = '%s.Request' % module_name
    expected.response_type = '%s.Response' % module_name

    described = descriptor.describe_method(remote_method)
    described.check_initialized()
    self.assertEquals(expected, described)
Exemplo n.º 6
0
    def testDescribe(self):
        class Request(messages.Message):
            pass

        class Response(messages.Message):
            pass

        @remote.method(Request, Response)
        def remote_method(request):
            pass

        module_name = test_util.get_module_name(DescribeMethodTest)
        expected = descriptor.MethodDescriptor()
        expected.name = 'remote_method'
        expected.request_type = '%s.Request' % module_name
        expected.response_type = '%s.Response' % module_name

        described = descriptor.describe_method(remote_method)
        described.check_initialized()
        self.assertEquals(expected, described)
 def testFindMethod(self):
   self.assertEquals(
     descriptor.describe_method(registry.RegistryService.services),
     descriptor.import_descriptor_loader(
       'protorpc.registry.RegistryService.services'))
Exemplo n.º 8
0
 def testFindMethod(self):
     self.assertEquals(
         descriptor.describe_method(registry.RegistryService.services),
         descriptor.import_descriptor_loader(
             'protorpc.registry.RegistryService.services'))