Django DRY Tests
Package with new powerful TestCases and Assets to test django application fast. TDD is supported
You can find Full Project Documentation here
Workflows
Package
Support
Downloads
Languages
Development
Mission
The mission of the Django DRY Tests to design and develop open source python package to test django
application
- fast
- with minimal code duplication
- with the ability to use TDD easily
- simple and comfortable
Open Source Project
This is the open source project with MIT license.
Be free to use, fork, clone and contribute.
Features
- Special Request, Response and Form classes to simple set test data
- Special SimpleTestCase and TestCase classes with new asserts:
-
- The main asserts is assertTrueResponse and assertTrueForm. You can use this for most cases.
-
Requirements
Development Status
Install
with pip
pip install django-dry-tests
See more in Full Documentation
Quickstart
To test view
class QuickStartViewSimpleTestCase(SimpleTestCase):
"""
SimpleTestCase example
"""
def test_get(self):
"""
Test Example with django-dry-tests
:return:
"""
request = Request(
url='/quickstart/'
)
true_response = TrueResponse(
status_code=200,
context=Context(
keys=['quickstart'],
values=['Quickstart'],
items={
'quickstart': 'Quickstart'
},
types={
'quickstart': str
}
),
content_values = [
'Quickstart',
'<h1>Quickstart title</h1>'
],
)
current_response = request.get_response(self.client)
self.assertTrueResponse(current_response, true_response)
To test Form
class ExampleFromTestCase(SimpleTestCase):
"""
Example Form Test Class
"""
def test_form(self):
"""
Example Test with django-dry-tests
:return:
"""
true_form = TrueForm(
Fields(
count=2,
names=[
'number', 'name'
],
types={
'name': forms.CharField,
'number': forms.IntegerField
}
),
)
current_form = ExampleForm()
self.assertTrueForm(current_form, true_form)
Contributing
You are welcome! To easy start please check: