Mocking pymongo in Flask
Your mock_user
and mock_pymongo
arguments are in wrong order; the outermost @patch (first/furthest away from the method) is the last method argument. It should be
@patch('arounded.userv2.views.User')@patch('arounded.userv2.views.pymongo')def test_valid_prelogin(self, mock_pymongo, mock_user):