===== eq-dj-test-back
'eq-dj-test-back' is a Django reusable app to help you make unit tests easier.
Requirements
- djangorestframework
Quick start
-
pip install eq-dj-test-back==
-
Add "eq_dj_test_back" to your INSTALLED_APPS setting like this::
INSTALLED_APPS = [ 'eq_dj_test_back', ... ]
-
Import the module like this:
from eq_dj_test_back.base_test_view import ViewsTestBase (or whatever TestBase you need)
And that's all.
Usage
- Testing a model functionality:
-
Import the module: from eq_dj_test_back.base_test_model import ModelTestBase
-
Make a class for every class you need to test: class TestSomeModel(ModelTestBase): fixtures = ['some_model.json']
def setUp(self): > Include the objects or what you feel necesary for the tests def test_some_method(self): self.base_test_model('method_name', 'maybe an assertion value', kwargs_of_method) > This will make an assertion with the specified data
-
- Testing a serializer functionality:
-
Import the module: from eq_dj_test_back.base_test_serializer import SerializerTestBase
-
Make a class for every class you need to test: class TestSomeSerializer(SerializerTestBase): fixtures = ['some_serializer.json']
def setUp(self): self.data = {required data for feed a serializer class} self.serializer = SerializerClass > Include the objects or what you feel necesary for the tests def test_some_method(self): self.assertEqual( self.base_test_ser('method_name', kwargs_of_method), 'assertion_value or something') > This will make a separated assertion using the instance or whatever the method returns
-
- Testing a view functionality:
-
Import the module: from eq_dj_test_back.base_test_view import ViewsTestBase
-
Make a class for every class you need to test: class TestSomeView(ViewsTestBase): fixtures = ['some_view.json']
def setUp(self): self.user_pk = The pk used to authenticate the request self.to_path = 'identifier to feed the reverse method' for the url path self.data = {required data for generate a request} self.view = SomeView.as_view() the view that you want to test itself super(TestSomeView, self).setUp() used to extends the module's setUp method with the attrs before mentioned def test_some_method(self): self.base_test_view( 'method', data, status_code_to_assert, self.get_path(self.to_path, kwargs to reverse function), kwargs to view function)
-
Metadata
Release files for eq-dj-test-back 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| eq-dj-test-back-0.0.4.tar.gz | 5.7 kB | Without provenance | Details for eq-dj-test-back-0.0.4.tar.gz |
Release files / eq-dj-test-back-0.0.4.tar.gz
| Download URL | eq-dj-test-back-0.0.4.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9cb911368987df646c036dcca501d5e2a7a4090d1364dd8205f74de7a67ea7b1
|
|
BLAKE2b-256 checksum How to use checksums |
f9bdfa9c394806e3dad5ba3c1db53b2b11be21a5386a02c0a62d9d6236e5f6b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.10
|
Security for eq-dj-test-back 0.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.