Source

pentasubmitter / src / submitter / tests / views.py

"""
unittests for submitter application, views
"""

import sys
import unittest
import datetime
from markdown import markdown
from django.test import Client, TestCase
from django.contrib.auth.models import User
from django.db import IntegrityError
from submitter import admin, models, views
from pentasubmitter import settings, template
from show.models import PentaShow, ShowType

class ViewTests(TestCase):
    """Test view functions from content.views"""

    def setUp(self):
        self.client = Client()
        self.user = User(username="pentasubmitter")
        self.user.set_password("pssst")
        self.user.save()

    def test_page_index(self):
        """GET the index view
        taken from:
        http://www.djangoproject.com/documentation/models/test_client/
        """
        # The data is ignored, but let's check it doesn't crash the system
        # anyway.
        data = {'var': u'\xf2'}
        response = self.client.get('/submit/', data)

        # Check some response details
        self.assertEqual(response.status_code, 302)
        response = self.client.get('/account/signin/')
        self.assertEqual(response.status_code, 200)
        self.assertTrue(
            self.client.login(username="pentasubmitter", password="pssst")
        )
        response = self.client.get('/submit/', data)
        #self.assertEqual(response.status_code, 200)
        #self.assertContains(
        #    response,
        #    'c3d2',
        #)
        #self.assertEqual(response.template[0].name,
        #                 'submitter/newsentry_archive.html'),
        #self.assertEqual(response.template[1].name, 'main.html')


# vim: ts=4 et sw=4 fileencoding=utf-8 :
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.