def test_connect_uri_with_authsource(self):
        # Create users
        c = connect('mongoenginetest')
        c.admin.system.users.remove({})
        c.admin.add_user('username2', 'password')

        # Authentication fails without "authSource"
        if IS_PYMONGO_3:
            test_conn = connect('mongoenginetest', alias='test1',
                                host='mongodb://username2:password@localhost/mongoenginetest')
            self.assertRaises(OperationFailure, test_conn.server_info)
        else:
            self.assertRaises(
                ConnectionError, connect, 'mongoenginetest', alias='test1',
                host='mongodb://username2:password@localhost/mongoenginetest'
            )
            self.assertRaises(ConnectionError, get_db, 'test1')

        # Authentication succeeds with "authSource"
        connect(
            'mongoenginetest', alias='test2',
            host=('mongodb://username2:password@localhost/'
                  'mongoenginetest?authSource=admin')
        )
        # This will fail starting from MongoDB 2.6+
        db = get_db('test2')
        self.assertTrue(isinstance(db, pymongo.database.Database))
        self.assertEqual(db.name, 'mongoenginetest')

        # Clear all users
        c.admin.system.users.remove({})
Get debugged process state
dataset/ETHPy150Open MongoEngine/mongoengine/tests/test_connection.py/ConnectionTest.test_connect_uri_with_authsource--crossover with--dataset/ETHPy150Open EiNSTeiN-/idapython/python/idc.py/GetProcessState