/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/plugins/launchpad/test_account.py

  • Committer: Aaron Bentley
  • Date: 2008-10-21 14:08:31 UTC
  • mto: This revision was merged to the branch mainline in revision 3789.
  • Revision ID: aaron@aaronbentley.com-20081021140831-a8sqdr5sg8y82z4e
Switch from dict to Registry for plugin_cmds

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007, 2008 Canonical Ltd
 
1
# Copyright (C) 2007 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
"""Tests for Launchpad user ID management functions."""
18
18
 
61
61
        # Test formatting of NoRegisteredSSHKeys exception
62
62
        error = account.NoRegisteredSSHKeys(user='test-user')
63
63
        self.assertEqualDiff('The user test-user has not registered any '
64
 
            'SSH keys with Launchpad.\n'
65
 
            'See <https://launchpad.net/people/+me>',
66
 
            str(error))
 
64
                             'SSH keys with Launchpad.', str(error))
67
65
 
68
66
    def test_set_lp_login_updates_authentication_conf(self):
69
 
        self.assertIs(None, account._get_auth_user())
 
67
        self.assertEqual([None, None], account._get_auth_user().values())
70
68
        account.set_lp_login('foo')
71
 
        self.assertEqual('foo', account._get_auth_user())
 
69
        self.assertEqual({'production': 'foo', 'staging': 'foo'},
 
70
                         account._get_auth_user())
72
71
 
73
72
    def test_get_lp_login_does_not_update_for_none_user(self):
74
73
        account.get_lp_login()
75
 
        self.assertIs(None, account._get_auth_user())
 
74
        self.assertEqual([None, None], account._get_auth_user().values())
76
75
 
77
76
    def test_get_lp_login_updates_authentication_conf(self):
78
77
        account._set_global_option('foo')
79
 
        self.assertIs(None, account._get_auth_user())
 
78
        self.assertEqual([None, None], account._get_auth_user().values())
80
79
        account.get_lp_login()
81
 
        auth = config.AuthenticationConfig()
82
 
        self.assertEqual('foo', account._get_auth_user(auth))
83
 
        self.assertEqual('foo', auth.get_user('ssh', 'bazaar.launchpad.net'))
84
 
        self.assertEqual('foo', auth.get_user('ssh',
85
 
                                              'bazaar.staging.launchpad.net'))
 
80
        self.assertEqual({'production': 'foo', 'staging': 'foo'},
 
81
                         account._get_auth_user())
86
82
 
87
83
    def test_get_lp_login_leaves_existing_credentials(self):
88
84
        auth = config.AuthenticationConfig()