64
64
'SSH keys with Launchpad.', str(error))
66
66
def test_set_lp_login_updates_authentication_conf(self):
67
self.assertEqual([None, None], account._get_auth_user().values())
67
self.assertIs(None, account._get_auth_user())
68
68
account.set_lp_login('foo')
69
self.assertEqual({'production': 'foo', 'staging': 'foo'},
70
account._get_auth_user())
69
self.assertEqual('foo', account._get_auth_user())
72
71
def test_get_lp_login_does_not_update_for_none_user(self):
73
72
account.get_lp_login()
74
self.assertEqual([None, None], account._get_auth_user().values())
73
self.assertIs(None, account._get_auth_user())
76
75
def test_get_lp_login_updates_authentication_conf(self):
77
76
account._set_global_option('foo')
78
self.assertEqual([None, None], account._get_auth_user().values())
77
self.assertIs(None, account._get_auth_user())
79
78
account.get_lp_login()
80
self.assertEqual({'production': 'foo', 'staging': 'foo'},
81
account._get_auth_user())
79
auth = config.AuthenticationConfig()
80
self.assertEqual('foo', account._get_auth_user(auth))
81
self.assertEqual('foo', auth.get_user('ssh', 'bazaar.launchpad.net'))
82
self.assertEqual('foo', auth.get_user('ssh',
83
'bazaar.staging.launchpad.net'))
83
85
def test_get_lp_login_leaves_existing_credentials(self):
84
86
auth = config.AuthenticationConfig()