# Path: quotes/tests/utils.py
# def create_test_tag():
#     name = 'Tag'
#     tag = Tag.objects.create(name=name)
#     now = datetime.now()
#     for i in xrange(10):
#         body = 'Test quote %d' % i
#         quote = Quote.objects.create(body=body, publish_date=now)
#         quote.tags.add(tag)
#     return tag


from lxml import html
from django.test import TestCase
from django.test.client import Client
from quotes.tests.utils import create_test_tag
        self.dom = html.fromstring(response.content)

    def testSubmitQuotePageResponse(self):
        response = self.client.get('/submit/')
        assert response.status_code, 200

    def testSubmitQuotePageShouldHaveTheRightTitle(self):
        self.__load_dom()
        assert self.dom.cssselect('h1')[0].text_content(), 'Submit Quote'

    def testSubmitQuotePageShouldHaveAFormToSubmitQuotes(self):
        self.__load_dom()
        form = self.dom.cssselect('form[role="form"]')
        assert len(form), 1
        assert form[0].attrib['action'], '/submit/'
        assert len(self.dom.cssselect('form[role="form"] input[type="text"][name="name"]')), 1
        assert len(self.dom.cssselect('form[role="form"] input[type="email"][name="email"]')), 1
        assert len(self.dom.cssselect('form[role="form"] input[type="text"][name="source"]')), 1
        assert len(self.dom.cssselect('form[role="form"] input[type="text"][name="authors"]')), 1
        assert len(self.dom.cssselect('form[role="form"] input[type="text"][name="tags"]')), 1
        assert len(self.dom.cssselect('form[role="form"] textarea[name="quote"]')), 1
        assert len(self.dom.cssselect('form[role="form"] input[type="submit"]')), 1

    def testUserShouldBeAbleToSubmitQuoteWithPOST(self):
        self.__load_dom()
        response = self.client.post('/submit/')
        assert response.status_code, 200

    def testFormSubmittedWithInvalidDataShouldDisplayErrors(self):
        response = self.client.post('/submit/')

# Path: quotes/tests/utils.py
# def create_test_tag():
#     name = 'Tag'
#     tag = Tag.objects.create(name=name)
#     now = datetime.now()
#     for i in xrange(10):
#         body = 'Test quote %d' % i
#         quote = Quote.objects.create(body=body, publish_date=now)
#         quote.tags.add(tag)
#     return tag


# Path: quotes/tests/requests/test_submit_quote_page.py
from lxml import html
from django.test import TestCase
from django.test.client import Client
from quotes.tests.utils import create_test_tag

        self.dom = html.fromstring(response.content)

    def testSubmitQuotePageResponse(self):
        response = self.client.get('/submit/')
        assert response.status_code, 200

    def testSubmitQuotePageShouldHaveTheRightTitle(self):
        self.__load_dom()
        assert self.dom.cssselect('h1')[0].text_content(), 'Submit Quote'

    def testSubmitQuotePageShouldHaveAFormToSubmitQuotes(self):
        self.__load_dom()
        form = self.dom.cssselect('form[role="form"]')
        assert len(form), 1
        assert form[0].attrib['action'], '/submit/'
        assert len(self.dom.cssselect('form[role="form"] input[type="text"][name="name"]')), 1
        assert len(self.dom.cssselect('form[role="form"] input[type="email"][name="email"]')), 1
        assert len(self.dom.cssselect('form[role="form"] input[type="text"][name="source"]')), 1
        assert len(self.dom.cssselect('form[role="form"] input[type="text"][name="authors"]')), 1
        assert len(self.dom.cssselect('form[role="form"] input[type="text"][name="tags"]')), 1
        assert len(self.dom.cssselect('form[role="form"] textarea[name="quote"]')), 1
        assert len(self.dom.cssselect('form[role="form"] input[type="submit"]')), 1

    def testUserShouldBeAbleToSubmitQuoteWithPOST(self):
        self.__load_dom()
        response = self.client.post('/submit/')
        assert response.status_code, 200

    def testFormSubmittedWithInvalidDataShouldDisplayErrors(self):
        response = self.client.post('/submit/')

        self.dom = html.fromstring(response.content)