Hi,
I am getting the error NameError: name ‘writeConcern’ is not defined while running user_preferences test.
Could you please help me understand the issue?
Here is the error script:
""" Ticket: Durable Writes Please increase the durability of this method by using a non-default write concern with ``insert_one``. """ try: # TODO: User Management # Insert a user with the "name", "email", and "password" fields. # TODO: Durable Writes # Use a more durable Write Concern for this operation.
db.users.insert_one({"name": name, "email": email, "password": hashedpw}, {writeConcern: {w: "majority"}})
E NameError: name ‘writeConcern’ is not defined
mflix\db.py:411: NameError
_________________________ test_empty_prefs_are_valid __________________________client = <FlaskClient <Flask ‘mflix.factory’>>
@pytest.mark.user_preferences def test_empty_prefs_are_valid(client): new_prefs = {} result = update_prefs("foobaz@bar.com", new_prefs)
assert result.matched_count == 1
E AttributeError: ‘dict’ object has no attribute ‘matched_count’
tests\test_user_preferences.py:67: AttributeError
============== 3 failed, 1 passed, 35 deselected in 5.57 seconds ==============
Thank you!