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/template_vows.py

47 lines
1.2 KiB
Python
Raw Normal View History

2011-05-10 03:45:24 +00:00
#!/usr/bin/python
# -*- 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
2011-08-18 14:28:51 +00:00
from django_pyvows.context import DjangoContext
from django_pyvows.assertions import *
2011-05-10 03:45:24 +00:00
@Vows.batch
class TemplateVows(DjangoContext):
def get_settings(self):
2011-05-10 03:45:24 +00:00
return 'sandbox.settings'
2011-08-18 14:28:51 +00:00
class IndexTemplate(DjangoContext):
2011-05-10 03:45:24 +00:00
def topic(self):
return self.template('index.html', {
2011-05-10 03:45:24 +00:00
'some': 'thing'
})
def should_have_container_div(self, topic):
expect(topic).to_contain('div.container')
def should_not_have_a_hello_div(self, topic):
expect(topic).Not.to_contain('div.hello')
2011-05-10 09:19:02 +00:00
def should_be_index_file(self, topic):
expect(unicode(topic)).to_equal('index.html')
2011-08-18 14:28:51 +00:00
class Paragraph(DjangoContext):
2011-05-10 03:45:24 +00:00
def topic(self, template):
return template.get_text('p.my-text')
def should_have_paragraph_with_text(self, topic):
expect(topic).to_be_like('some text')