Ticket: Create/Update Comments

Hello everyone,

I am stuck on this ticket…the pytest script all 4 tests passes…see below…

(mflix_venv) PS C:\Education\MongoDB\M220P\mflix-python> pytest -m create_update_comments
============================= test session starts =============================
platform win32 – Python 3.8.3, pytest-3.3.0, py-1.8.0, pluggy-0.6.0
rootdir: C:\Education\MongoDB\M220P\mflix-python, inifile: pytest.ini
plugins: flask-0.11.0
collected 43 items

tests\test_create_update_comments.py … [100%]

============================= 39 tests deselected =============================
=================== 4 passed, 39 deselected in 1.36 seconds ===================

BUT, when do the test from the ui, it comes up with red box with below message:
“Create/Update Comments: Unable to update comment”

I am not sure what i have to do…any idea?

-Jatin

Do you sort the comment in getMovie as per the requirements?

yes. The sorting is there on date field. The pytest is passing all 4 tests so if there is an issue with sorting that should have failed…

i was able to fix the issue…i had to change below line
From:
{ “_id” : comment_id, “email” : user_email }
To:
{ “_id” : ObjectId(comment_id), “email” : user_email }

i am not sure why automated tests were passing if update_comment functions is broken…(-:

-Jatin

3 Likes

Thanks for your feedback @Jatin_73145. I will look into the code and will get back to you.

Cc @Shubham_Ranjan

Kanika

1 Like

I have faced same, need to change code in other function.

def add_user(name, email, hashedpw):

in this function, please remove or comment “{“writeConcern”:{“w”:“majority”}}” code and try it.

I am facing a similar kind of issue in which pytest is failing but when I submitted the original answer then also it not passing the test can anyone help me