def test_ipv6(self): try: connection = ReplicaSetConnection("[::1]:%d" % (port,), replicaSet=self.name) except: # Either mongod was started without --ipv6 # or the OS doesn't support it (or both). raise SkipTest() # Try a few simple things connection = ReplicaSetConnection("mongodb://[::1]:%d" % (port,), replicaSet=self.name) connection = ReplicaSetConnection("mongodb://[::1]:%d/?safe=true;" "replicaSet=%s" % (port, self.name)) connection = ReplicaSetConnection("[::1]:%d,localhost:" "%d" % (port, port), replicaSet=self.name) connection = ReplicaSetConnection("localhost:%d,[::1]:" "%d" % (port, port), replicaSet=self.name) connection.pymongo_test.test.save({"dummy": u"object"}) connection.pymongo_test_bernie.test.save({"dummy": u"object"}) dbs = connection.database_names() self.assertTrue("pymongo_test" in dbs) self.assertTrue("pymongo_test_bernie" in dbs) connection.close()
def test_ipv6(self): try: connection = ReplicaSetConnection("[::1]:27017", replicaSet=self.name) except: # Either mongod was started without --ipv6 # or the OS doesn't support it (or both). raise SkipTest() # Try a few simple things connection = ReplicaSetConnection("mongodb://[::1]:27017", replicaSet=self.name) uri = "mongodb://[::1]:27017/?slaveOk=true;replicaSet=" + self.name connection = ReplicaSetConnection(uri) connection = ReplicaSetConnection("[::1]:27017,localhost:27017", replicaSet=self.name) connection = ReplicaSetConnection("localhost:27017,[::1]:27017", replicaSet=self.name) connection.pymongo_test.test.save({"dummy": u"object"}) connection.pymongo_test_bernie.test.save({"dummy": u"object"}) dbs = connection.database_names() self.assert_("pymongo_test" in dbs) self.assert_("pymongo_test_bernie" in dbs) connection.close()
def test_ipv6(self): try: connection = ReplicaSetConnection("[::1]:27017", replicaSet=self.name) except: # Either mongod was started without --ipv6 # or the OS doesn't support it (or both). raise SkipTest() # Try a few simple things connection = ReplicaSetConnection("mongodb://[::1]:27017", replicaSet=self.name) uri = "mongodb://[::1]:27017/?slaveOk=true;replicaSet=" + self.name connection = ReplicaSetConnection(uri) connection = ReplicaSetConnection("[::1]:27017,localhost:27017", replicaSet=self.name) connection = ReplicaSetConnection("localhost:27017,[::1]:27017", replicaSet=self.name) connection.pymongo_test.test.save({"dummy": u"object"}) connection.pymongo_test_bernie.test.save({"dummy": u"object"}) dbs = connection.database_names() self.assert_("pymongo_test" in dbs) self.assert_("pymongo_test_bernie" in dbs) connection.close()