def test_invalid_hash(self, db_client): db_client().get_doc.return_value = make_future(UNVERIFIED_USER) with pytest.raises(exceptions.ValidationError): yield User.verify(UNVERIFIED_USER['_id'], 'something') assert not User.db_client().save_doc.called
def test_verified_user(self, db_client): db_client().get_doc.return_value = make_future(USERS[0]) user = yield User.verify(USERS[0]['_id'], 'something') assert user.id == USERS[0]['_id'] assert not User.db_client().save_doc.called