Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove e.message deprecation warning when running tests #3121

merged 1 commit into from Jun 17, 2016


Copy link

@brew brew commented Jun 17, 2016

There's a deprecation warning when running tests:

DeprecationWarning: BaseException.message has been deprecated as of Python 2.6
assert_true('/my/prefix/user/logout' in e.message)

Which leads to this test in

We shouldn't need to follow the redirect to assert that a redirect is returned. Following the redirect returns a 404 in any case, because the test instance isn't mounted at root_path, and testing the resulting exception is a bit weird.

This PR removes the attempt to follow the redirect and instead tests that the appropriate url is the basis for the redirect when requesting a logout.

final_response = helpers.webtest_maybe_follow(logout_response)
except Exception as e:
assert_true('/my/prefix/user/logout' in e.message)
assert_equal(logout_response.status_int, 302)
Copy link

@k-nut k-nut Jun 17, 2016

Isn't this already implicitly checked by supplying status in the app.get above? That will fail if the status is something other then the one given, won't it?

Copy link
Member Author

@brew brew Jun 17, 2016

Yep - totally. But I wanted to be explicit that the status is part of what we're testing.

Copy link

@k-nut k-nut Jun 17, 2016

OK, cool. I do agree that this makes the test much more readable! 🙂

@amercader amercader merged commit 9fb9f57 into master Jun 17, 2016
2 checks passed
@amercader amercader deleted the 3121-logout-test branch Jun 17, 2016
k-nut pushed a commit to k-nut/ckan that referenced this issue Jul 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants