Ejemplo n.º 1
0
    def test_put_node(self):
        stub = IndexStub(self.channel)

        # get node
        request = GetStatusRequest()
        response = stub.GetStatus(request)
        self.assertEqual(
            0,
            pickle.loads(response.node_status)['partner_nodes_count'])
        self.assertEqual(True, response.status.success)

        # put node
        request = PutNodeRequest()
        request.node_name = 'localhost:{0}'.format(get_free_port())
        response = stub.PutNode(request)
        sleep(1)  # wait for node to be added
        self.assertEqual(True, response.status.success)

        # get node
        request = GetStatusRequest()
        response = stub.GetStatus(request)
        self.assertEqual(
            1,
            pickle.loads(response.node_status)['partner_nodes_count'])
        self.assertEqual(True, response.status.success)
Ejemplo n.º 2
0
    def test_get_status(self):
        stub = IndexStub(self.channel)

        # get node
        request = GetStatusRequest()
        response = stub.GetStatus(request)
        self.assertEqual(
            0,
            pickle.loads(response.node_status)['partner_nodes_count'])
        self.assertEqual(True, response.status.success)