[ckan-changes] [ckan/ckan] 9b9313: [#3196] Fix redirect import

GitHub noreply at github.com
Thu Sep 1 12:19:15 UTC 2016


  Branch: refs/heads/3196-common-url_for-tests
  Home:   https://github.com/ckan/ckan
  Commit: 9b9313fb5176fb0fec81f9db1973a389b4c28025
      https://github.com/ckan/ckan/commit/9b9313fb5176fb0fec81f9db1973a389b4c28025
  Author: amercader <amercadero at gmail.com>
  Date:   2016-08-31 (Wed, 31 Aug 2016)

  Changed paths:
    M ckan/tests/config/test_sessions.py

  Log Message:
  -----------
  [#3196] Fix redirect import


  Commit: 00a9193c58510659d077b72bb1339e75b99824ab
      https://github.com/ckan/ckan/commit/00a9193c58510659d077b72bb1339e75b99824ab
  Author: amercader <amercadero at gmail.com>
  Date:   2016-08-31 (Wed, 31 Aug 2016)

  Changed paths:
    M ckan/config/deployment.ini_tmpl
    M ckan/config/middleware/flask_app.py
    M ckan/config/routing.py
    M ckan/controllers/feed.py
    M ckan/lib/render.py
    M ckan/lib/search/__init__.py
    R ckan/lib/search/sql.py
    M ckan/tests/controllers/test_feed.py
    R ckan/tests/legacy/lib/test_simple_search.py
    M ckanext/datapusher/cli.py
    M ckanext/example_theme/custom_config_setting/plugin.py
    M ckanext/example_theme/custom_emails/tests.py
    M ckanext/reclineview/plugin.py
    M doc/contributing/test.rst
    M doc/maintaining/configuration.rst

  Log Message:
  -----------
  Merge branch 'master' into 3196-common-url_for-tests

Conflicts:
	ckan/config/middleware/flask_app.py


  Commit: 43767c78390f389b62767f7e38cfdba7d68a958b
      https://github.com/ckan/ckan/commit/43767c78390f389b62767f7e38cfdba7d68a958b
  Author: amercader <amercadero at gmail.com>
  Date:   2016-09-01 (Thu, 01 Sep 2016)

  Changed paths:
    M ckan/lib/alphabet_paginate.py
    M ckan/tests/config/test_middleware.py
    M ckan/tests/config/test_sessions.py
    M ckan/tests/controllers/test_admin.py
    M ckan/tests/controllers/test_api.py
    M ckan/tests/controllers/test_feed.py
    M ckan/tests/controllers/test_group.py
    M ckan/tests/controllers/test_home.py
    M ckan/tests/controllers/test_organization.py
    M ckan/tests/controllers/test_package.py
    M ckan/tests/controllers/test_tags.py
    M ckan/tests/controllers/test_user.py
    M ckan/tests/controllers/test_util.py
    M ckan/tests/lib/test_helpers.py
    M ckan/tests/lib/test_mailer.py
    M ckan/tests/logic/action/test_create.py

  Log Message:
  -----------
  [#3196] 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.


  Commit: 2d83e0d1366a76c8f83fd316301b9976f38fab62
      https://github.com/ckan/ckan/commit/2d83e0d1366a76c8f83fd316301b9976f38fab62
  Author: amercader <amercadero at gmail.com>
  Date:   2016-09-01 (Thu, 01 Sep 2016)

  Changed paths:
    M ckan/tests/controllers/test_package.py
    M ckan/tests/legacy/__init__.py
    M ckan/tests/legacy/functional/api/base.py
    M ckan/tests/legacy/functional/api/model/test_package.py
    M ckan/tests/legacy/functional/api/model/test_relationships.py
    M ckan/tests/legacy/functional/api/model/test_vocabulary.py
    M ckan/tests/legacy/functional/api/test_activity.py
    M ckan/tests/legacy/functional/api/test_dashboard.py
    M ckan/tests/legacy/functional/api/test_email_notifications.py
    M ckan/tests/legacy/functional/api/test_follow.py
    M ckan/tests/legacy/functional/api/test_resource.py
    M ckan/tests/legacy/functional/api/test_user.py
    M ckan/tests/legacy/functional/api/test_util.py
    M ckan/tests/legacy/functional/test_activity.py
    M ckan/tests/legacy/functional/test_admin.py
    M ckan/tests/legacy/functional/test_group.py
    M ckan/tests/legacy/functional/test_package.py
    M ckan/tests/legacy/functional/test_pagination.py
    M ckan/tests/legacy/functional/test_preview_interface.py
    M ckan/tests/legacy/functional/test_revision.py
    M ckan/tests/legacy/functional/test_tag.py
    M ckan/tests/legacy/functional/test_tracking.py
    M ckan/tests/legacy/functional/test_user.py
    M ckan/tests/legacy/html_check.py
    M ckan/tests/legacy/lib/test_alphabet_pagination.py
    M ckan/tests/legacy/logic/test_action.py
    M ckan/tests/legacy/logic/test_auth.py
    M ckan/tests/legacy/misc/test_format_text.py
    M ckan/tests/legacy/models/test_package.py
    M ckan/tests/legacy/test_coding_standards.py

  Log Message:
  -----------
  [#3196] Fix legacy tests dependant on url_for

Wrapping calls to url_for (and functions that call it firther down the
line) with the Flask test_request_context, update functional tests to
use the helpers._get_test_app function rather than old paster ones.


  Commit: 22cb37d62841771481d1567323a7b0d6ea1949e9
      https://github.com/ckan/ckan/commit/22cb37d62841771481d1567323a7b0d6ea1949e9
  Author: amercader <amercadero at gmail.com>
  Date:   2016-09-01 (Thu, 01 Sep 2016)

  Changed paths:
    M ckanext/datapusher/tests/test.py
    M ckanext/datapusher/tests/test_interfaces.py
    M ckanext/datastore/tests/test_create.py
    M ckanext/datastore/tests/test_delete.py
    M ckanext/datastore/tests/test_dump.py
    M ckanext/datastore/tests/test_upsert.py
    M ckanext/example_iauthfunctions/tests/test_example_iauthfunctions.py
    M ckanext/example_idatasetform/tests/test_controllers.py
    M ckanext/example_igroupform/tests/test_controllers.py
    M ckanext/example_itranslation/tests/test_plugin.py
    M ckanext/imageview/tests/test_view.py
    M ckanext/multilingual/tests/test_multilingual_plugin.py
    M ckanext/reclineview/tests/test_view.py
    M ckanext/resourceproxy/tests/test_proxy.py
    M ckanext/stats/tests/test_stats_plugin.py
    M ckanext/textview/tests/test_view.py

  Log Message:
  -----------
  [#3196] Fix ckanext tests dependant on url_for

Same as previous commits, using the app from
tests.helpers._get_test_app and request contexts when necessary


Compare: https://github.com/ckan/ckan/compare/9b9313fb5176^...22cb37d62841


More information about the ckan-changes mailing list