def test_connect_to_replica_set(self): db = connect('test', host="localhost:27017,localhost:27018", replicaSet="rs0", port=27018, io_loop=self.io_loop) res = yield from db.ping() ping_result = res['ok'] expect(ping_result).to_equal(1.0)
def test_can_connect_to_a_database(self): db = connect('test', host="localhost", port=27017, io_loop=self.io_loop) res = yield from db.ping() ping_result = res['ok'] expect(ping_result).to_equal(1.0)
def setUp(self, auto_connect=True): self.io_loop = asyncio.new_event_loop() asyncio.set_event_loop(None) if auto_connect: self.db = connect("test", host="localhost", port=27017, io_loop=self.io_loop)
def test_database_returns_collection_when_asked_for_a_name(self): db = connect("test", host="localhost", port=27017, io_loop=self.io_loop) expect(db.something).to_be_instance_of( motor.motor_asyncio.AsyncIOMotorCollection)
def test_database_ping(self): db = connect("test", host="localhost", port=27017, io_loop=self.io_loop) res = yield from db.ping() ping_result = res['ok'] expect(ping_result).to_equal(1.0) disconnect()