[ckan-changes] [okfn/ckan] f3d0de: [#1117] Move some validator tests into the right t...

GitHub noreply at github.com
Fri Jul 26 18:23:58 UTC 2013


  Branch: refs/heads/1117-start-new-test-suite
  Home:   https://github.com/okfn/ckan
  Commit: f3d0de6208486528f0e08f7edcbba70faea2dd86
      https://github.com/okfn/ckan/commit/f3d0de6208486528f0e08f7edcbba70faea2dd86
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-07-26 (Fri, 26 Jul 2013)

  Changed paths:
    M ckan/new_tests/lib/navl/test_validators.py
    A ckan/new_tests/logic/test_validators.py

  Log Message:
  -----------
  [#1117] Move some validator tests into the right test module

Oops :)


  Commit: f234745c5f034ce59fb919dcf5536688a664bb88
      https://github.com/okfn/ckan/commit/f234745c5f034ce59fb919dcf5536688a664bb88
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-07-26 (Fri, 26 Jul 2013)

  Changed paths:
    M ckan/new_tests/data.py
    M ckan/new_tests/lib/navl/test_validators.py

  Log Message:
  -----------
  [#1117] Move some helpers into shared test helper data module


  Commit: a3485a1fa4a872abc3d29f382069f34785f72f1e
      https://github.com/okfn/ckan/commit/a3485a1fa4a872abc3d29f382069f34785f72f1e
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-07-26 (Fri, 26 Jul 2013)

  Changed paths:
    M ckan/new_tests/logic/test_validators.py

  Log Message:
  -----------
  [#1117] Add unit tests for user_name_validator()


  Commit: 807b601f3ade09aac3f0ef0d530e947774e93975
      https://github.com/okfn/ckan/commit/807b601f3ade09aac3f0ef0d530e947774e93975
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-07-26 (Fri, 26 Jul 2013)

  Changed paths:
    M ckan/logic/validators.py
    M ckan/new_tests/logic/action/test_update.py

  Log Message:
  -----------
  [#1117] Fix user_password validator

Commit f3165ce (user_update: don't crash on non-string password)
unwittingly changed the behavior of user_password_validator(), causing
some legacy tests to fail:

If the given password is Missing or '' user_password_validator() should
*not* raise Invalid.

Fiux user_password_validator to not raise Invalid in these cases, so
that the tests pass again.


  Commit: 51cd5d18c4005f469c6052a6bddc3275b6373cde
      https://github.com/okfn/ckan/commit/51cd5d18c4005f469c6052a6bddc3275b6373cde
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-07-26 (Fri, 26 Jul 2013)

  Changed paths:
    M ckan/new_tests/data.py

  Log Message:
  -----------
  [#1117] Tweak a docstring


  Commit: c6b953496177ca795ac9347eaf7986edb3049ed7
      https://github.com/okfn/ckan/commit/c6b953496177ca795ac9347eaf7986edb3049ed7
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-07-26 (Fri, 26 Jul 2013)

  Changed paths:
    M ckan/logic/validators.py

  Log Message:
  -----------
  [#1117] Refactor and add docstring to user_name_validator

- Add docstring

- Use model.User.get() to find whether a user exists, instead of a lot
  of SQLAlchemy in ckan.logic.

  This should make it easier to unit test user_name_validator() in
  isolation, because the tests will only have to mock one method
  ckan.model.User.get() instead of having to mock several things.

  Also SQLAlchemy should just be in the model anyway, not in the logic.

- Refactor and add code comments to clarify the obscure thing that
  user_name_validator() does with context['user_obj'] on user_update()s.

  This was completely obscure before, now hopefully it's clearer.
  (But it's a bad design anyway, user_create and user_update shouldn't
  be sharing the same user_name_validator function.)

I don't *think* I broke anything by refactoring this (tests
are still passing).


  Commit: 93d0d819cc68cc3e84b472eefdf4fa3f26f32c07
      https://github.com/okfn/ckan/commit/93d0d819cc68cc3e84b472eefdf4fa3f26f32c07
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-07-26 (Fri, 26 Jul 2013)

  Changed paths:
    M ckan/new_tests/logic/test_validators.py

  Log Message:
  -----------
  [#1117] Mock ckan.model in user_name_validator() tests

Now that user_name_validator() has been refactored to call
model.User.get() instead of doing its own SQLAlchemy (commit c6b953),
it's really easy to mock ckan.model in the user_name_validator() unit
tests by just mocking the single method ckan.model.User.get().

This means the user_name_validator() unit tests no longer touch the disk
or db or bring in ckan.model.


Compare: https://github.com/okfn/ckan/compare/a0a3d93ca87d...93d0d819cc68


More information about the ckan-changes mailing list