~lutostag/ubuntu/trusty/maas/1.5.4+keystone

« back to all changes in this revision

Viewing changes to src/maasserver/tests/test_views_account.py

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez
  • Date: 2013-03-04 11:49:44 UTC
  • mto: This revision was merged to the branch mainline in revision 25.
  • Revision ID: package-import@ubuntu.com-20130304114944-azcvu9anlf8mizpa
Tags: upstream-1.3+bzr1452+dfsg
ImportĀ upstreamĀ versionĀ 1.3+bzr1452+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 
15
15
from django.conf import settings
16
16
from lxml.html import fromstring
 
17
from maasserver.testing import extract_redirect
17
18
from maasserver.testing.factory import factory
18
19
from maasserver.testing.testcase import TestCase
19
20
 
34
35
        response = self.client.get('/accounts/login/')
35
36
        self.assertTrue(response.context['no_users'])
36
37
        self.assertEqual(path, response.context['create_command'])
 
38
 
 
39
    def test_login_redirects_when_authenticated(self):
 
40
        password = factory.getRandomString()
 
41
        user = factory.make_user(password=password)
 
42
        self.client.login(username=user.username, password=password)
 
43
        response = self.client.get('/accounts/login/')
 
44
        self.assertEqual('/', extract_redirect(response))