Exemplo n.º 1
0
    def testClientWorks(self):
        server = self.service.requireTask(MultiplexedServer)

        # Verify the client and service for FooService/Handler
        client = ThriftClient.for_localhost(
            server.bound_port,
            module=SERVICES.FooService,
            multiplex_service='FooHandler',
        )
        self.assertEqual(
            client.makeFoos(3),
            "foofoofoo",
        )

        # Make sure makeBars does not work for FooService
        with self.assertRaises(Exception):
            client.makeBars(1)

        # Verify the client and service for BarService/Handler
        client = ThriftClient.for_localhost(
            server.bound_port,
            module=SERVICES.BarService,
            multiplex_service='bar',
        )
        self.assertEqual(
            client.makeBars(2),
            "barbar",
        )

        # Make sure makeFoos does not work for BarService
        with self.assertRaises(Exception):
            client.makeFoos(1)
Exemplo n.º 2
0
    def testClientWorks(self):
        server = self.service.requireTask(MultiplexedServer)

        # Verify the client and service for FooService/Handler
        client = ThriftClient.for_localhost(
            server.bound_port,
            module=SERVICES.FooService,
            multiplex_service='FooHandler',
        )
        self.assertEqual(
            client.makeFoos(3),
            "foofoofoo",
        )

        # Make sure makeBars does not work for FooService
        with self.assertRaises(Exception):
            client.makeBars(1)

        # Verify the client and service for BarService/Handler
        client = ThriftClient.for_localhost(
            server.bound_port,
            module=SERVICES.BarService,
            multiplex_service='bar',
        )
        self.assertEqual(
            client.makeBars(2),
            "barbar",
        )

        # Make sure makeFoos does not work for BarService
        with self.assertRaises(Exception):
            client.makeFoos(1)
Exemplo n.º 3
0
 def testNBServerCommand(self):
     server = self.service.requireTask(NBServerTask)
     client = ThriftClient.for_localhost(
             server.bound_port, module=FacebookService)
     self.assertEquals(client.getStatus(), fb_status.ALIVE)
Exemplo n.º 4
0
 def testNBServerCommand(self):
     server = self.service.requireTask(NBServerTask)
     client = ThriftClient.for_localhost(server.bound_port,
                                         module=FacebookService)
     self.assertEquals(client.getStatus(), fb_status.ALIVE)