Fixing some mistakes in the previsious readme.
This commit is contained in:
parent
9b50636ce8
commit
b9a5f58789
1 changed files with 20 additions and 14 deletions
34
README.md
34
README.md
|
@ -15,25 +15,31 @@ Django-pyvows
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
|
|
||||||
Add to the
|
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:
|
||||||
INSTALLED_APPS = (
|
|
||||||
....
|
|
||||||
'django_pyvows',
|
|
||||||
....
|
|
||||||
)
|
|
||||||
|
|
||||||
And create the vows as you usually would
|
|
||||||
|
|
||||||
from pyvows import Vows, expect
|
from pyvows import Vows, expect
|
||||||
|
|
||||||
from django_pyvows.context import DjangoContext
|
from django_pyvows.context import DjangoHTTPContext
|
||||||
|
|
||||||
@Vows.batch
|
@Vows.batch
|
||||||
class ContextTest(Vows.Context):
|
class ContextTest(DjangoHTTPContext):
|
||||||
|
|
||||||
|
def setup(self):
|
||||||
|
self.start_server()
|
||||||
|
|
||||||
def topic(self):
|
def topic(self):
|
||||||
return DjangoContext.start_environment(None)
|
return self.get('/mygreaturl/')
|
||||||
|
|
||||||
def should_be_an_error(self, topic):
|
def should_be_a_success(self, topic):
|
||||||
expect(topic).to_be_an_error()
|
expect(topic.getcode()).to_equal(200)
|
||||||
|
|
||||||
|
def should_return_the_correct_response_type(self, topic):
|
||||||
|
expect(topic.headers.type).to_equal("text/html")
|
||||||
|
|
||||||
|
For work properly you need to configure your django settings module overriding
|
||||||
|
the method `get_settings` from DjangoHTTPContext. If you settings module are in python
|
||||||
|
path as I can import them simple doing `import settings` then are no need to override
|
||||||
|
the `get_settings` method. We have some other methods that you can use to personalize you
|
||||||
|
testing context, but I will explain after. Keep in touch to get some new things that I plan
|
||||||
|
to implement.
|
||||||
|
|
Reference in a new issue