Skip to main content

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

Tests Pylint

Package

Version Development Status Python version License Wheel

Support

Documentation Discussions Issues

Downloads

Day Downloads Week Downloads Month Downloads All Downloads

Languages

Languages Top Language

Development

  • Release date Last Commit
  • Issues Closed Issues
  • Pull Requests Closed Pull Requests
  • Discussions

Menu

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:
        """
        # Create Request Model
        request = Request(
            url='/quickstart/'
        )

        # Create Response Model to check all view.
        # You can set only one param without others to check it.
        true_response = TrueResponse(
            status_code=200,
            context=Context(
                keys=['quickstart'],  # check that quickstart key in context
                values=['Quickstart'],  # check that "Quickstart" value in context
                items={
                    'quickstart': 'Quickstart'
                },  # check both keys and values in context
                types={
                    'quickstart': str
                }  # check values types without check values
            ),
            content_values = [
                'Quickstart',
                '<h1>Quickstart title</h1>'
            ],  # check values after template will be rendered
        )

        # get url response with Django default Test Client
        current_response = request.get_response(self.client)
        # Use main assert to run all asserts
        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(  # Set Up TrueForm instance
               Fields(  # TrueForm Fields
                   count=2,  # check fields count
                   names=[
                       'number', 'name'
                   ],  # check field names
                   types={
                       'name': forms.CharField,
                       'number': forms.IntegerField
                   }  # check fields types
               ),
            )
        current_form = ExampleForm()  # Get project form
        self.assertTrueForm(current_form, true_form)  # use this main assert to check all conditions

More examples in Full Documentation

Contributing

You are welcome! To easy start please check:

Metadata

Release files for django-dry-tests 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-dry-tests 1.0.0
File Size Uploaded
django-dry-tests-1.0.0.tar.gz 8.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-dry-tests 1.0.0
File Interpreter ABI Platform
django_dry_tests-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 19.2 kB

Release files / django-dry-tests-1.0.0.tar.gz

Download URL django-dry-tests-1.0.0.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d36c4f4c00f5b6e94f9c5a744081b24320fbffa524f28338dd27cd1935fb5200
BLAKE2b-256 checksum
How to use checksums
b7fdf303479a210a9d5d2dd577b25935ea024daa6e7ef59dc7955549f6c9d458
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release files / django_dry_tests-1.0.0-py3-none-any.whl

Download URL django_dry_tests-1.0.0-py3-none-any.whl
Size 10.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
073f2f110d046eeba951957e66089a770b5ccc15be6ab0e38eaadfa9e543c611
BLAKE2b-256 checksum
How to use checksums
a84b15c2c049db844622a94e99fff0eed49e379c65e699d331b0a6bd5a3e4c7d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page