🚦 A pyVows extension for testing Django applications.
This repository has been archived on 2023-01-02. You can view files and clone it, but cannot push or open issues or pull requests.
Find a file
2015-07-20 09:57:38 +02:00
django_pyvows Support to unique test configuration 2015-07-19 11:42:54 +02:00
sandbox Reoganize project to reflect final usage 2015-07-19 12:20:37 +02:00
vows Use builtin assertions 2015-07-19 12:25:39 +02:00
.gitignore Update gitignore 2015-07-18 21:55:59 +02:00
Makefile Reoganize project to reflect final usage 2015-07-19 12:20:37 +02:00
README.md Fix README 2015-07-19 13:34:58 +02:00
requirements.txt Update Django version to 1.8.3 2015-07-18 21:55:44 +02:00
setup.py Settings 2012-03-09 14:02:27 -03:00

Django-PyVows

This project is an extension of pyVows to test Django projects. It enables usage of core Django testing tools in a way that is in sync with pyVows workflow mindset.

PyVows is a BDD (Behaviour Driven Development) inspired by Vows for node.js

More documentation about pyVows can be found at the project homepage or for more updated usage check the project tests itself.

Django-PyVows is in sync with the latest Django developments and supports Django 1.8.

Usage

There is no need to modify your project to use Django-PyVows. You only have to define where is your project settings module and start calling your project urls in your tests.

from pyvows import Vows, expect

from django_pyvows.context import DjangoContext

@Vows.batch
class SimpleTestVows(DjangoContext):

    def settings_module(self):
        return 'yourproject.settings'

    def topic(self):
        return self.get('/mygreaturl/')

    def should_be_a_success(self, topic):
        expect(topic.status_code).to_equal(200)

    def should_return_the_correct_response(self, topic):
        expect(topic).contains("Welcome!")

The default settings_module is settings so you should define it accordly based on your PYTHONPATH.

HTTP Client

We support django.test.Client, the methods DjangoContext.get and DjangoContext.post are actually simple wrappers around it so the usage is the same. The test client is also available in the DjangoContext instance as self.client.

Assertions

The available assertions in Django-PyVows are the same as in django.test.SimpleTestCase they were adapted to the context of BDD and PyVows.

Settings Override

TODO