Exemplo n.º 1
0
    def setUp(self):
        """Sets up the client and verifies the version is compatible."""

        self.client = create_client(self.TEST_SERVER_ADDR)
        version = self.client.any_client().check_version(pydgraph.Check())

        # version.tag string format is v<MAJOR>.<MINOR>.<PATCH>
        # version_tup = [MAJOR, MINOR, PATCH]
        version_tup = version.tag[1:].split('.')

        version_supported = int(version_tup[0]) > 0
        self.assertTrue(
            version_supported,
            'Dgraph server version must be >= v1.0.0, got %s' % version.tag)
Exemplo n.º 2
0
 def test_close(self):
     client_stub = pydgraph.DgraphClientStub(addr=self.TEST_SERVER_ADDR)
     self.check_version(client_stub)
     client_stub.close()
     with self.assertRaises(Exception):
         client_stub.check_version(pydgraph.Check())
Exemplo n.º 3
0
 def test_timeout(self):
     with self.assertRaises(Exception):
         pydgraph.DgraphClientStub(self.TEST_SERVER_ADDR).check_version(
             pydgraph.Check(), timeout=-1)
Exemplo n.º 4
0
 def check_version(self, stub):
     self.validate_version_object(stub.check_version(pydgraph.Check()))