def testRegistry(self):
     registry_client = self.GetRegistryStub()
     response = registry_client.services()
     self.assertIterEqual([
         registry.ServiceMapping(
             name='/my/other_service',
             definition='protorpc.webapp_test_util.TestService'),
         registry.ServiceMapping(
             name='/my/service',
             definition='protorpc.webapp_test_util.TestService'),
     ], response.services)
Example #2
0
  def CheckServiceMappings(self, mappings):
    module_name = test_util.get_module_name(RegistryServiceTest)
    service1_mapping = registry.ServiceMapping()
    service1_mapping.name = 'my-service1'
    service1_mapping.definition = '%s.MyService1' % module_name

    service2_mapping = registry.ServiceMapping()
    service2_mapping.name = 'my-service2'
    service2_mapping.definition = '%s.MyService2' % module_name

    self.assertIterEqual(mappings, [service1_mapping, service2_mapping])
Example #3
0
    def CheckServiceMappings(self, mappings):
        module_name = test_util.get_module_name(RegistryServiceTest)
        service1_mapping = registry.ServiceMapping()
        service1_mapping.name = 'my-service1'
        service1_mapping.definition = '%s.MyService1' % module_name

        service2_mapping = registry.ServiceMapping()
        service2_mapping.name = 'my-service2'
        service2_mapping.definition = '%s.MyService2' % module_name

        mappings.sort(key=lambda mapping: mapping.name)

        self.assertEquals(mappings[0], service1_mapping)
        self.assertEquals(mappings[1], service2_mapping)
Example #4
0
    def testRegistry(self):
        request = Request1(string_field='request value')
        status, response = self.DoRequest('/protorpc.services',
                                          message_types.VoidMessage(),
                                          registry.ServicesResponse)

        self.assertEquals('Status: 200 OK', status)
        self.assertIterEqual([
            registry.ServiceMapping(
                name='/protorpc',
                definition='protorpc.registry.RegistryService'),
            registry.ServiceMapping(name='/my_service',
                                    definition='test_package.GetCalled'),
        ], response.services)
 def testAltRegistry(self):
     self.ResetServer(
         service.service_mappings(
             [('/my/service', webapp_test_util.TestService),
              ('/my/other_service',
               webapp_test_util.TestService.new_factory('initialized'))],
             registry_path='/registry'))
     registry_client = self.GetRegistryStub('/registry')
     services = registry_client.services()
     self.assertTrue(isinstance(services, registry.ServicesResponse))
     self.assertIterEqual([
         registry.ServiceMapping(
             name='/my/other_service',
             definition='protorpc.webapp_test_util.TestService'),
         registry.ServiceMapping(
             name='/my/service',
             definition='protorpc.webapp_test_util.TestService'),
     ], services.services)
 def testRegistryDictionary(self):
     self.ResetServer(
         service.service_mappings({
             '/my/service':
             webapp_test_util.TestService,
             '/my/other_service':
             webapp_test_util.TestService.new_factory('initialized'),
         }))
     registry_client = self.GetRegistryStub()
     response = registry_client.services()
     self.assertIterEqual([
         registry.ServiceMapping(
             name='/my/other_service',
             definition='protorpc.webapp_test_util.TestService'),
         registry.ServiceMapping(
             name='/my/service',
             definition='protorpc.webapp_test_util.TestService'),
     ], response.services)