2011-08-23 14:13:54 +00:00
|
|
|
Django-Pyvows
|
|
|
|
=============
|
2011-08-18 23:08:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
Pyvows
|
|
|
|
-------
|
|
|
|
|
|
|
|
pyvows is a BDD (Behaviour Driven Development) inspired by Vows for node.js
|
|
|
|
|
|
|
|
More documentation about pyvows can be found at the project homepage
|
|
|
|
|
|
|
|
http://pyvows.org
|
|
|
|
|
2011-08-23 14:13:54 +00:00
|
|
|
Django-Pyvows
|
2011-08-18 23:08:10 +00:00
|
|
|
--------------
|
|
|
|
|
2011-08-23 14:13:54 +00:00
|
|
|
This project contains extensions to test Django projects under pyVows.
|
|
|
|
|
|
|
|
Using Django-Pyvows
|
|
|
|
-------------------
|
2011-08-18 23:08:10 +00:00
|
|
|
|
2011-08-19 02:33:52 +00:00
|
|
|
There is no need to modify your project to use Django-PyVows. You only have to create the vows
|
|
|
|
as you usually would, start the server and call your project urls:
|
2011-08-18 23:08:10 +00:00
|
|
|
|
2011-08-23 14:18:12 +00:00
|
|
|
```python
|
|
|
|
from pyvows import Vows, expect
|
2011-08-18 23:08:10 +00:00
|
|
|
|
2011-08-23 14:18:12 +00:00
|
|
|
from django_pyvows.context import DjangoHTTPContext
|
2011-08-18 23:08:10 +00:00
|
|
|
|
2011-08-23 14:18:12 +00:00
|
|
|
@Vows.batch
|
|
|
|
class ContextTest(DjangoHTTPContext):
|
2011-08-19 02:33:52 +00:00
|
|
|
|
2011-08-23 14:18:12 +00:00
|
|
|
def setup(self):
|
|
|
|
self.start_server()
|
2011-08-18 23:08:10 +00:00
|
|
|
|
2011-08-23 14:18:12 +00:00
|
|
|
def topic(self):
|
|
|
|
return self.get('/mygreaturl/')
|
2011-08-19 02:33:52 +00:00
|
|
|
|
2011-08-23 14:18:12 +00:00
|
|
|
def should_be_a_success(self, topic):
|
|
|
|
expect(topic.getcode()).to_equal(200)
|
2011-08-19 02:33:52 +00:00
|
|
|
|
2011-08-23 14:18:12 +00:00
|
|
|
def should_return_the_correct_response_type(self, topic):
|
|
|
|
expect(topic.headers.type).to_equal("text/html")
|
|
|
|
```
|
2011-08-18 23:08:10 +00:00
|
|
|
|
2011-08-19 13:05:48 +00:00
|
|
|
To work you only need to override the `get_settings` method from DjangoHTTPContext to
|
|
|
|
return the path of your settings module. The default `get_settings` returns `"settings"`.
|
2011-08-23 14:13:54 +00:00
|
|
|
|
|
|
|
More info: https://github.com/rafaelcaricio/django-pyvows/wiki
|
2013-09-09 13:56:54 +00:00
|
|
|
|
|
|
|
External links
|
|
|
|
--------------
|
|
|
|
- Asynchronous Testing with Django and PyVows
|
|
|
|
- http://www.realpython.com/blog/python/asynchronous-testing-with-django-and-pyvows/
|
|
|
|
- Unit Testing with pyVows and Django
|
|
|
|
- http://www.realpython.com/blog/python/unit-testing-with-pyvows-and-django/
|
2013-09-25 10:41:37 +00:00
|
|
|
- Integration testing with pyVows and Django
|
|
|
|
- http://www.realpython.com/blog/python/integration-testing-with-pyvows-and-django/
|