Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix ckan/ tests (no legacy) depending on url_for
The Flask url_for function requires an application context to be present when generating a url_for. This is obviously not the case when calling it from a test, so we need to wrap the function on a test_request_context (which will create an app context): with app.flask_app.test_request_context(): url_for(...) For tests that don't require an app like helpers or mailer this is done automatically in the tests setup. Note that all URLs generated now take ckan.site_url into account, so tests checking for `http://localhost/some-url` will fail as the correct url is `http://test.ckan.net/some-url`, as this is the site_url used on test-core.ini.
- Loading branch information
Showing
12 changed files
with
1,022 additions
and
512 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.