-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:okfn/ckan into translation-doc-de…
…precated
- Loading branch information
Showing
60 changed files
with
2,963 additions
and
4,140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
''' | ||
Controller tests probably shouldn't use mocking. | ||
.. todo:: | ||
Write the tests for one controller, figuring out the best way to write | ||
controller tests. Then fill in this guidelines section, using the first set | ||
of controller tests as an example. | ||
Some things have been decided already: | ||
* All controller methods should have tests | ||
* Controller tests should be high-level tests that work by posting simulated | ||
HTTP requests to CKAN URLs and testing the response. So the controller | ||
tests are also testing CKAN's templates and rendering - these are CKAN's | ||
front-end tests. | ||
For example, maybe we use a webtests testapp and then use beautiful soup | ||
to parse the HTML? | ||
* In general the tests for a controller shouldn't need to be too detailed, | ||
because there shouldn't be a lot of complicated logic and code in | ||
controller classes. The logic should be handled in other places such as | ||
:mod:`ckan.logic` and :mod:`ckan.lib`, where it can be tested easily and | ||
also shared with other code. | ||
* The tests for a controller should: | ||
* Make sure that the template renders without crashing. | ||
* Test that the page contents seem basically correct, or test certain | ||
important elements in the page contents (but don't do too much HTML | ||
parsing). | ||
* Test that submitting any forms on the page works without crashing and | ||
has the expected side-effects. | ||
* When asserting side-effects after submitting a form, controller tests | ||
should user the :func:`ckan.new_tests.helpers.call_action` function. For | ||
example after creating a new user by submitting the new user form, a | ||
test could call the :func:`~ckan.logic.action.get.user_show` action | ||
function to verify that the user was created with the correct values. | ||
.. warning:: | ||
Some CKAN controllers *do* contain a lot of complicated logic code. These | ||
controllers should be refactored to move the logic into :mod:`ckan.logic` or | ||
:mod:`ckan.lib` where it can be tested easily. Unfortunately in cases like | ||
this it may be necessary to write a lot of controller tests to get this | ||
code's behavior into a test harness before it can be safely refactored. | ||
''' |
Oops, something went wrong.