[ckan-changes] [ckan/ckan] 15fcae: More tweaks to url_for

GitHub noreply at github.com
Thu Jun 2 13:33:47 UTC 2016


  Branch: refs/heads/poc-flask-views.common-url_for
  Home:   https://github.com/ckan/ckan
  Commit: 15fcae6943b2358f48504a359511df24712e1a41
      https://github.com/ckan/ckan/commit/15fcae6943b2358f48504a359511df24712e1a41
  Author: amercader <amercadero at gmail.com>
  Date:   2016-06-02 (Thu, 02 Jun 2016)

  Changed paths:
    M ckan/lib/helpers.py

  Log Message:
  -----------
  More tweaks to url_for

Flask url_for doesn't allow to override the host and scheme from the WSGI
environment, so we need to manually set it from the config values by
tweaking the generated url.

Also simplify the qualified params logic.


  Commit: a41fd3bb15f77aaddc138cf62baaa0b2b9ee6d6e
      https://github.com/ckan/ckan/commit/a41fd3bb15f77aaddc138cf62baaa0b2b9ee6d6e
  Author: amercader <amercadero at gmail.com>
  Date:   2016-06-02 (Thu, 02 Jun 2016)

  Changed paths:
    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

  Log Message:
  -----------
  Fix tests using url_for

The Flask url_for function requires an application context to be present
when generating a url_for. This is obviuosly not the case when calling
it from a test, so we need to wrap the function on a
test_request_context:
   with app.flask_app.test_request_context():
      url_for(...)


  Commit: 878394ba69e046a90da6850d1df53dac291ddfd3
      https://github.com/ckan/ckan/commit/878394ba69e046a90da6850d1df53dac291ddfd3
  Author: amercader <amercadero at gmail.com>
  Date:   2016-06-02 (Thu, 02 Jun 2016)

  Changed paths:
    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/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/misc/test_format_text.py
    M ckan/tests/legacy/models/test_package.py
    M ckan/tests/legacy/test_coding_standards.py

  Log Message:
  -----------
  First go at fixing the legacy tests

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.
Still some failures, related to

* Template rendering
* Request object
* PEP8


Compare: https://github.com/ckan/ckan/compare/8b20f15eb555...878394ba69e0


More information about the ckan-changes mailing list