Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

An extension of django tests that contains premade cases with the most comom tests for a web application

Project description

A unit test framework for Django that will make your unit tests as easy as it should be

Code Health Latest PyPI version Number of PyPI downloads License

What is Easy Test?

Easy Test is an extension of Django’s test framework for the purpose of providing premade configurable test cases, avoiding code replication and increasing test coverage in the project.

How to install?

Download the module using pip:

pip install django-easy-test

Then add it to your INSTALLED_APPS on your

    # ...

How to use?

To use it simply extend the wanted test case configuring it with a meta class:

class MyTest(FormTest):
    class Meta:
        obj = Person(
            name='John Doe',
        url = 'my_url'

You can also check our example project Easy Test Example containning functional samples for each test case comparing the conventional test with Easy Test. Please find an example below:

A conventional form test

 class TaskNewGet(TestCase):
    def setUp(self):
        self.response = self.client.get(resolve_url('task_new'))

    def test_html(self):
        tags = (
            ('<input', 3),
            ('<textarea', 1),
            ('type="text"', 1),
            ('type="submit"', 1),

        for text, count in tags:
            with self.subTest():
                self.assertContains(self.response, text, count)

    def test_csrf(self):
        self.assertContains(self.response, 'csrfmiddlewaretoken')

    def test_has_form(self):
        form = self.response.context['form']

class TaskNewPostValid(TestCase):
    def setUp(self):
        data = dict(name='Easy Test', description='')
        self.response ='task_new'), data)

    def test_save_subscription(self):

class TaskNewPostInvalid(TestCase):
    def setUp(self):
        self.response ='task_new'),{})

    def test_post(self):

    def test_template(self):
        self.assertTemplateUsed(self.response, "core/task_form.html")

    def test_has_form(self):
        form = self.response.context['form']

    def test_has_erros(self):
        form = self.response.context['form']

    def test_not_save_subscription(self):

Same test using Easy Test

class TaskFormEasyTest(FormTest):
    class Meta:
        obj = Task(
            name='Easy Test',
            description='A unit test framework for Django that will make your unit tests as easy as it should be.'
        url = 'task_new'
        template = 'core/task_form.html'
        contents = [
            ('<input', 3),
            ('<textarea', 1),
            ('type="text"', 1),
            ('type="submit"', 1)
        form = TaskForm

Project details

Release history Release notifications

This version
History Node


History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date (10.4 kB) Copy SHA256 hash SHA256 Source None Jan 8, 2017

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page