Skip to content

Commit

Permalink
docs: Explain how unit tests work
Browse files Browse the repository at this point in the history
  • Loading branch information
mauricioabreu committed Jun 7, 2018
1 parent 4b9dcbe commit 43087c4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 11 additions & 0 deletions docs/contributing/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,16 @@ Here is an example on how to test the creation of a new configuration:
cname=['www.example-cname.com'], delivery_protocol='http')
assert isinstance(configuration, Configuration)
Cassettes
~~~~~~~~~

`Cassettes` are the files used to store/load requests and responses. A good convention is to name them with the resource capitalized
and the action of the API function in lowercase, for example: ``Configuration_create``

Unit tests
----------

Fast feedback can be given by unit tests. These are tests used to cover units of code in isolation - they should not depend on other components.
And to achieve this goal, we must not rely on third party results like JSON responses obtained over a unreliable network.

`Mocking` the response is the right way to go here, ensuring that we called our function with the right parameters.
1 change: 0 additions & 1 deletion tests/integration/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,3 @@ def test_delete_configuration(self):

with recorder.use_cassette('Configuration_delete'):
assert client.delete_configuration(1528252734)

0 comments on commit 43087c4

Please sign in to comment.