~widelands-dev/widelands-website/django_staticfiles

« back to all changes in this revision

Viewing changes to wlscreens/tests/test_views.py

  • Committer: Holger Rapp
  • Date: 2009-04-11 15:21:15 UTC
  • Revision ID: rapp@mrt.uka.de-20090411152115-qpbnxxze99td19bz
Added a first version of a screenshot application

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python -tt
 
2
# encoding: utf-8
 
3
#
 
4
 
 
5
from django.test import TestCase as DjangoTest, Client
 
6
from django.core.urlresolvers import reverse
 
7
from django.contrib.auth.models import User
 
8
from wlscreens.models import *
 
9
 
 
10
import os
 
11
 
 
12
###########
 
13
# Helpers #
 
14
###########
 
15
class _LoginToSite(DjangoTest):
 
16
    def setUp(self):
 
17
        u = User.objects.create(username="root", email="root@root.com")
 
18
        u.set_password("root")
 
19
        u.save()
 
20
        
 
21
        self.client.login( username="root", password="root")
 
22
 
 
23
#############
 
24
# TestCases #
 
25
#############
 
26
###########
 
27
# Uploads #
 
28
###########
 
29
class TestWLScreens_IndexSite_ExceptCorrectResult(_LoginToSite):
 
30
    def runTest(self):
 
31
        url = reverse('wlscreens_index')
 
32
        k = self.client.get(url)
 
33
 
 
34
        self.assertTemplateUsed(k,"wlscreens/index.html")
 
35
        self.assertTrue("categories" in k.context)
 
36
 
 
37