~maas-committers/maas/1.2

« back to all changes in this revision

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

  • Committer: Raphael Badin
  • Date: 2014-04-14 14:00:13 UTC
  • mto: This revision was merged to the branch mainline in revision 1388.
  • Revision ID: raphael.badin@canonical.com-20140414140013-adplw1zvllpap4zu
Fix 1.2 incompatibility.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
from lxml.html import fromstring
19
19
from maasserver.testing import get_content_links
20
20
from maasserver.testing.factory import factory
21
 
from maasserver.testing.testcase import TestCase
 
21
from maasserver.testing.testcase import (
 
22
    LoggedInTestCase,
 
23
    TestCase,
 
24
    )
22
25
 
23
26
 
24
27
class TestLogin(TestCase):
39
42
        self.assertEqual(path, response.context['create_command'])
40
43
 
41
44
 
42
 
class TestLogout(TestCase):
 
45
class TestLogout(LoggedInTestCase):
43
46
 
44
47
    def test_logout_link_present_on_homepage(self):
45
 
        self.client_log_in()
46
48
        response = self.client.get(reverse('index'))
47
49
        logout_link = reverse('logout')
48
50
        self.assertIn(
53
55
        # Using POST for logging out, along with Django's csrf_token
54
56
        # tag, guarantees that we're protected against CSRF attacks on
55
57
        # the loggout page.
56
 
        self.client_log_in()
57
58
        self.client.post(reverse('logout'))
58
59
        self.assertNotIn(SESSION_KEY, self.client.session.keys())