def test_connect_in_mocking(self):
        """Ensure that the connect() method works properly in mocking.
        """
        try:
            import mongomock
        except __HOLE__:
            raise SkipTest('you need mongomock installed to run this testcase')

        connect('mongoenginetest', host='mongomock://localhost')
        conn = get_connection()
        self.assertTrue(isinstance(conn, mongomock.MongoClient))

        connect('mongoenginetest2', host='mongomock://localhost', alias='testdb2')
        conn = get_connection('testdb2')
        self.assertTrue(isinstance(conn, mongomock.MongoClient))

        connect('mongoenginetest3', host='mongodb://localhost', is_mock=True, alias='testdb3')
        conn = get_connection('testdb3')
        self.assertTrue(isinstance(conn, mongomock.MongoClient))

        connect('mongoenginetest4', is_mock=True, alias='testdb4')
        conn = get_connection('testdb4')
        self.assertTrue(isinstance(conn, mongomock.MongoClient))

        connect(host='mongodb://localhost:27017/mongoenginetest5', is_mock=True, alias='testdb5')
        conn = get_connection('testdb5')
        self.assertTrue(isinstance(conn, mongomock.MongoClient))

        connect(host='mongomock://localhost:27017/mongoenginetest6', alias='testdb6')
        conn = get_connection('testdb6')
        self.assertTrue(isinstance(conn, mongomock.MongoClient))

        connect(host='mongomock://localhost:27017/mongoenginetest7', is_mock=True, alias='testdb7')
        conn = get_connection('testdb7')
        self.assertTrue(isinstance(conn, mongomock.MongoClient))
dataset/ETHPy150Open MongoEngine/mongoengine/tests/test_connection.py/ConnectionTest.test_connect_in_mocking