Chap 2 - User management failed test [SOLVED]

I need help with this:

================================== FAILURES ===================================
______________________________ test_registration ______________________________

client = <FlaskClient <Flask 'mflix.factory'>>

    def test_registration(client):
        # the password will be hashed at the api layer
        # NEVER
        # NEVER
        # NEVER store passwords in plaintext

        result = add_user(test_user.get('name'), test_user.get(
            'email'), test_user.get('password'))

        assert result == {'success': True}

        found_user = get_user(test_user.get('email'))
>       assert found_user.get('name') == test_user.get('name')
E       AttributeError: 'Cursor' object has no attribute 'get'

tests\ AttributeError
============================= 39 tests deselected =============================
============== 1 failed, 3 passed, 39 deselected in 1.39 seconds ==============

Do you have any idea to what it can be related to? I don’t see any error in my functions:

def add_user(name, email, hashedpw):
            "name": name,
            "email": email,
            "password": hashedpw
        return {"success": True}
    except DuplicateKeyError:
        return {"error": "A user with the given email already exists."}

If I try to run the app, status page gets stuck with this error, I do not know if it is related:

  File "C:\...\mflix\api\", line 324, in make_admin_user_for_ui_test
    "email": userdata['email'],
  File "C:\...\Programs\Python\Python37\lib\site-packages\pymongo\", line 614, in __getitem__
    "instances" % index)
TypeError: index 'email' cannot be applied to Cursor instances

Thanks for the help.

The problem was here

def get_user(email):
    return db.users.find_one({ "email": email })

as I mistakenly modified “find_one” in “find” in some of my previous tries.
“find” returns a cursor, while “find_one” returns a documents, so this is why the app was throwing that error (TypeError: index ‘email’ cannot be applied to Cursor instances).