[ckan-changes] [ckan/ckan] 45371d: Add extra stuff to the WSGI environ sent during in...

GitHub noreply at github.com
Thu Jun 9 15:08:20 UTC 2016


  Branch: refs/heads/poc-flask-views.common-url_for-take-2-tests
  Home:   https://github.com/ckan/ckan
  Commit: 45371daa933e2991eb678e3d132a153b594ef83a
      https://github.com/ckan/ckan/commit/45371daa933e2991eb678e3d132a153b594ef83a
  Author: amercader <amercadero at gmail.com>
  Date:   2016-06-08 (Wed, 08 Jun 2016)

  Changed paths:
    M ckan/common.py
    M ckan/config/middleware/__init__.py

  Log Message:
  -----------
  Add extra stuff to the WSGI environ sent during invites

Also set SERVER_NAME and SERVER_PORT for consistency, and set up a
vendor CKAN key to be able to identify the environ as one of the ones
used for sending the WSGI invites. This is needed so the `is_flask`
function correctly returns the relevant value based on the request
environ.


  Commit: b96d32da85033cf281b793191427059facf94c24
      https://github.com/ckan/ckan/commit/b96d32da85033cf281b793191427059facf94c24
  Author: Brook Elgie <specialbrew at gmail.com>
  Date:   2016-06-08 (Wed, 08 Jun 2016)

  Changed paths:
    M ckan/config/middleware/flask_app.py

  Log Message:
  -----------
  Only return session if it's available on environ


  Commit: 77e0cfa28f471a207dc4c7ce17c80016fbcfe9b6
      https://github.com/ckan/ckan/commit/77e0cfa28f471a207dc4c7ce17c80016fbcfe9b6
  Author: amercader <amercadero at gmail.com>
  Date:   2016-06-08 (Wed, 08 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 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: ea7331e8921ff3ffd3ab362637e425578ca16123
      https://github.com/ckan/ckan/commit/ea7331e8921ff3ffd3ab362637e425578ca16123
  Author: amercader <amercadero at gmail.com>
  Date:   2016-06-08 (Wed, 08 Jun 2016)

  Changed paths:
    M ckan/config/middleware/flask_app.py
    M ckan/lib/helpers.py

  Log Message:
  -----------
  PEP8 fixes


  Commit: 8f0db2637c478f1bee705847d7bfc1baac6ad7e0
      https://github.com/ckan/ckan/commit/8f0db2637c478f1bee705847d7bfc1baac6ad7e0
  Author: amercader <amercadero at gmail.com>
  Date:   2016-06-08 (Wed, 08 Jun 2016)

  Changed paths:
    M ckan/common.py

  Log Message:
  -----------
  Provide support for request.params even on a Flask request

It is used all over the place and they both are dict-like objects


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

  Changed paths:
    M ckan/common.py
    M ckan/config/middleware/flask_app.py
    M ckan/lib/helpers.py

  Log Message:
  -----------
  Merge branch 'poc-flask-views.common-url_for-take-2' into poc-flask-views.common-url_for-take-2-tests


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

  Changed paths:
    M ckan/tests/controllers/test_package.py
    M ckan/tests/controllers/test_user.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/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:
  -----------
  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.


  Commit: 3298f6924a127ceca8ca38eb81cd018d68d9534a
      https://github.com/ckan/ckan/commit/3298f6924a127ceca8ca38eb81cd018d68d9534a
  Author: amercader <amercadero at gmail.com>
  Date:   2016-06-09 (Thu, 09 Jun 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:
  -----------
  Fix ckanext tests

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

Conflicts:
	ckanext/imageview/tests/test_view.py


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

  Changed paths:
    M ckan/tests/helpers.py
    M ckan/tests/lib/test_helpers.py

  Log Message:
  -----------
  Revert "Allow to modify the configuration of the test app"

This reverts commit 5d70f308fce34d53326b1bc2ca2aa618b2d72747.


Compare: https://github.com/ckan/ckan/compare/45371daa933e^...0d0763007a7e


More information about the ckan-changes mailing list