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

brew
Copy link
Member

@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 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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@amercader amercader merged commit 9fb9f57 into master Jun 17, 2016
@amercader amercader deleted the 3121-logout-test branch June 17, 2016 15:06
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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants