Update reference

I have the following code

response = db.users.update_one({“email”: email},
{"$set": {“preferences”: pref}},
upsert=False
)

it works with tests but doesn’t pass verification with following message “User Preferences: preferences weren’t saved correctly”. Does anyone have an idea what is it about?

This code looks good to me. What is the error message in console?

Kanika

Dear Kanika

Neither Browser nor Python provide output. So I can’t answer or I am terribly missing something…

  1. Unit Tests- Are the unit tests passing? What is the output when you run pytest -m user_preferences ?
  2. Integration Tests- When you run python run.py in your command line, what is the output in the same command line, when you try getting the validation code from STATUS page?

Kanika

Yeah, now I see that test don’t go well at all

tests/test_user_preferences.py::test_invalid_user_should_not_have_preferences PASSED [ 25%]
tests/test_user_preferences.py::test_should_not_allow_None_as_prefs FAILED [ 50%]
tests/test_user_preferences.py::test_valid_user_preferences FAILED [ 75%]
tests/test_user_preferences.py::test_empty_prefs_are_valid FAILED [100%]

I had the same code as the correct answer still it didn’t work…

hmmm…

don’t beat yourself up… just one letter missing can mess it all up… just one letter… just one…

Hi @Volodymyr_85458,

Feel free to share the code here, the changes you have made for the ticket.

Kanika