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.
django-pyvows/vows/assertions_vows.py

38 lines
1 KiB
Python
Raw Normal View History

# -*- coding: utf-8 -*-
# django-pyvows extensions
# https://github.com/rafaelcaricio/django-pyvows
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 Rafael Caricio rafael@caricio.com
from pyvows import Vows, expect
2015-07-19 09:42:54 +00:00
from test_config import ConfiguredVowsContext as DjangoContext
@Vows.batch
class DjangoAssertionsVows(DjangoContext):
class RedirectsTo(DjangoContext):
def topic(self):
return self.get("/say")
def should_redirect(self, topic):
expect(topic).redirects_to('/say/', status_code=301)
class Contains(DjangoContext):
def topic(self):
return self.get('/say/')
def should_work(self, topic):
expect(topic).contains('name')
class WithFormError(DjangoContext):
def topic(self):
return self.post('/post-name/', {'another_field': 'filled'})
def should_work(self, topic):
expect(topic).with_form_error('form', 'your_name', 'This field is required.')