1
# Copyright 2010 Canonical Ltd. This software is licensed under the
2
# GNU Affero General Public License version 3 (see the file LICENSE).
4
from django.conf import settings
5
from django.shortcuts import render_to_response
6
from django.template import RequestContext
8
import identityprovider.branding
9
from identityprovider.tests.utils import SQLCachedTestCase
12
class DummyRequest(object):
16
class BrandingTestCase(SQLCachedTestCase):
18
self.BRAND = settings.BRAND
21
self.set_branding(self.BRAND)
23
def set_branding(self, branding):
25
settings.BRAND = branding
27
reload(identityprovider.branding)
28
reload(identityprovider.context_processors)
30
def test_openid(self):
31
self.set_branding('Ubuntu')
32
r = self.client.get('/+openid')
33
self.assertContains(r, "This is the Ubuntu SSO service")
34
self.set_branding('Launchpad')
35
r = self.client.get('/+openid')
36
self.assertContains(r, "This is the Launchpad login service")
38
def test_decide(self):
39
self.set_branding('Ubuntu')
41
context = RequestContext(req, {'trust_root': 'foo', })
42
response = render_to_response('decide.html', context)
43
self.assertContains(response, 'recognised by\nUbuntu')
45
self.set_branding('Launchpad')
47
context = RequestContext(req, {'trust_root': 'foo', })
48
response = render_to_response('decide.html', context)
49
self.assertContains(response, 'recognised by\nLaunchpad')
52
class StaticPageTestCase(SQLCachedTestCase):
53
def test_faq_page(self):
54
r = self.client.get('/+faq')
55
self.assertContains(r, "Frequently asked questions")
56
r = self.client.get('/+description')
57
self.assertContains(r, "What's this?")