예제 #1
0
    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)
예제 #2
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)
예제 #3
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)
예제 #4
0
    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)
예제 #5
0
    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()