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
merged 1 commit into from Jun 17, 2016

Conversation

Projects
None yet
3 participants
@brew
Copy link
Member

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 test_user.py.

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)

This comment has been minimized.

Copy link
@k-nut

k-nut Jun 17, 2016

Contributor

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?

This comment has been minimized.

Copy link
@brew

brew Jun 17, 2016

Author Member

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

This comment has been minimized.

Copy link
@k-nut

k-nut Jun 17, 2016

Contributor

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

QuantifiedCode No new issues found.
Details
ci/circleci Your tests passed on CircleCI!
Details

@amercader amercader deleted the 3121-logout-test branch Jun 17, 2016

k-nut pushed a commit to k-nut/ckan that referenced this pull request Jul 4, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.