I am doing this ticket and the lecture leading up to it is TERRIBLE!!! No where. does it cover how to make your writes more durable…
# 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.
Along with that, there is no mention of how to use the jwt token… I assume that it is the set field in the session collection.
There is no way to test your code without completing all of the functions (that I know of)… Having said that, I ran the test and the first two fail. I looked at the test and also the output from the failed test and it seems to be failing on the delete user portion. There seems to already be an entry with the test data in the system…
This is really confusing on how to troubleshoot.
def test_registration(client):
delete_user('magicz@cats.com')
# 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}
E AssertionError: assert {'error': 'A ...eady exists.'} == {'success': True}
E Left contains more items:
E {'error': 'A user with the given email already exists.'}
E Right contains more items:
E {'success': True}
E Use -v to get the full diff
tests/test_user_management.py:24: AssertionError
This is my output on the first test… How do I troubleshoot this?
Because there is so many functions that need to be updated to make the ticket work, how do I ask questions without a lengthy and complicated queston?
I will start by debugging my add_user(name, email, hashedpw)
It seems that if I am going to add this user, all I need to do is pass in the variables in the insert_one() method… The name for “name”, email for “email”, and hashedpw for “password”
Where I am confused is in the TODO it says to use a more durable write… This isn’t even talked about and while I can find write_concern in the Pymongo documentation, I can’t find any examples of how to use it.