Skip to main content

eXtra Test Cases for Django

Project description

Django eXtra Test Cases

Django’s test cases focus on test cases for use with a database.

This is excellent as it is the hardest thing to do right. Yet, when creating (reusable) apps that do not have any models or testing views that do not use any models, you often find yourself doing the same thing with SimpleTestCase.

This issue is the focus of Django XTC.

TemplateTestCase

The core test case for testing templates. Requires a template test directory which can be set on the class level an will fall back to TEMPLATE_TEST_DIR using Django’s settings.

Below this directory, at least two subdirectories are used:

  • src: The template code

  • expect: The expected output of that template code

  • actual: (optional) Used if the output is to be saved for post-mortem

    analysis.

At the core is the test method assertTemplateEqual, which compares the expected template code with the actual. The template context (the variables) can be manipulated using the template_context attribute.

Project details


Download files

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

Source Distribution

django_xtc-0.1.0.tar.gz (6.6 kB view hashes)

Uploaded source

Built Distribution

django_xtc-0.1.0-py3-none-any.whl (8.1 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page