Skip to content

Instantly share code, notes, and snippets.

@harshvb7
Created August 14, 2019 20:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harshvb7/18d9e843dc7ca82e80c19b1416929674 to your computer and use it in GitHub Desktop.
Save harshvb7/18d9e843dc7ca82e80c19b1416929674 to your computer and use it in GitHub Desktop.
tests/views/test_project_detail_view.py
tests/views/.....
>> Views must ONLY test input and status code of the response. Mock the business logic to test the status code.
Ideally our views should be very SLIM and all the logic must go in services and helper functions
If we need to access some variables from request in the service, then better destructure it in the view and pass ONLY the variable in the service NEVER the request object.
In case of API view, call the service from the serializer after validating the input. Don't come back to the view with the validated input and then put the input again in the service.
tests/services/test_document_service.py
tests/models/..*
tests/forms/..* YEP FORMS!!!!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment