[ckan-changes] [okfn/ckan] 059407: Fix some PEP8 issues

GitHub noreply at github.com
Tue Nov 27 21:25:14 UTC 2012


  Branch: refs/heads/add-shared-post-method-for-api-tests
  Home:   https://github.com/okfn/ckan
  Commit: 0594077936740949f9875766f14365bc0363fd6e
      https://github.com/okfn/ckan/commit/0594077936740949f9875766f14365bc0363fd6e
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2012-11-27 (Tue, 27 Nov 2012)

  Changed paths:
    M ckan/tests/functional/api/__init__.py

  Log Message:
  -----------
  Fix some PEP8 issues


  Commit: b1f46c40298e741c3d6c2b01b14ef7eabc010192
      https://github.com/okfn/ckan/commit/b1f46c40298e741c3d6c2b01b14ef7eabc010192
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2012-11-27 (Tue, 27 Nov 2012)

  Changed paths:
    M ckan/tests/functional/api/__init__.py

  Log Message:
  -----------
  Tidy a couple of docstrings


  Commit: 3b84c92210aa3aaf761d3f03bea6a94f0f929038
      https://github.com/okfn/ckan/commit/3b84c92210aa3aaf761d3f03bea6a94f0f929038
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2012-11-27 (Tue, 27 Nov 2012)

  Changed paths:
    M ckan/tests/functional/api/__init__.py

  Log Message:
  -----------
  Delete a commented-out set_trace()


  Commit: d6c1e1cacb0178fa0a4c9c5bd81bf94c202d023b
      https://github.com/okfn/ckan/commit/d6c1e1cacb0178fa0a4c9c5bd81bf94c202d023b
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2012-11-27 (Tue, 27 Nov 2012)

  Changed paths:
    M ckan/tests/__init__.py
    M ckan/tests/functional/api/test_follow.py

  Log Message:
  -----------
  Add test helper function for posting to CKAN API

Add ckan.tests.post(), a helper function for posting to CKAN's action API and
getting the result, that handles forming the correct action API URL, converting
the apikey to a string and putting it in a headers dict like TestApp expects,
collecting params into a dict and dumping them to a JSON string, and checking
the 'success' field of the response.

This can save a lot of lines of code and make tests more readable. I've
converted test_follow.py as an example of how much can be saved.

Similar savings could be made in many other test modules:

ckan/tests/functional/api/model/test_vocabulary.py,
ckan/tests/functional/api/model/test_group.py,
ckan/tests/functional/api/test_dashboard.py,
ckan/tests/functional/api/test_activity.py,
ckan/tests/functional/test_follow.py,
ckan/tests/functional/test_tag_vocab.py,
ckan/tests/functional/test_related.py,
ckan/tests/logic/test_action.py
ckan/tests/logic/test_tag.py.

ckan/tests/functional/api/model/test_package.py could also be changed to use
this function. It currently uses a similar function defined in
ckan.tests.functional.api.base:ApiTestCase.


Compare: https://github.com/okfn/ckan/compare/059407793674^...d6c1e1cacb01


More information about the ckan-changes mailing list