~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_config.py

  • Committer: John Arbash Meinel
  • Date: 2008-10-17 19:58:53 UTC
  • mfrom: (3783 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3785.
  • Revision ID: john@arbash-meinel.com-20081017195853-i31d3g7sur1prgvi
Merge bzr.dev 3783, resolve NEWS

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006 Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 2008 Canonical Ltd
2
2
#   Authors: Robert Collins <robert.collins@canonical.com>
3
3
#
4
4
# This program is free software; you can redistribute it and/or modify
1412
1412
        self.assertEquals(True, credentials.get('verify_certificates'))
1413
1413
 
1414
1414
 
 
1415
class TestAuthenticationStorage(tests.TestCaseInTempDir):
 
1416
 
 
1417
    def test_set_credentials(self):
 
1418
        conf = config.AuthenticationConfig()
 
1419
        conf.set_credentials('name', 'host', 'user', 'scheme', 'password',
 
1420
        99, path='/foo', verify_certificates=False)
 
1421
        credentials = conf.get_credentials(host='host', scheme='scheme',
 
1422
                                           port=99, path='/foo')
 
1423
        CREDENTIALS = {'name': 'name', 'user': 'user', 'password': 'password',
 
1424
                       'verify_certificates': False,}
 
1425
        self.assertEqual(CREDENTIALS, credentials)
 
1426
        credentials_from_disk = config.AuthenticationConfig().get_credentials(
 
1427
            host='host', scheme='scheme', port=99, path='/foo')
 
1428
        self.assertEqual(CREDENTIALS, credentials_from_disk)
 
1429
 
 
1430
    def test_reset_credentials_different_name(self):
 
1431
        conf = config.AuthenticationConfig()
 
1432
        conf.set_credentials('name', 'host', 'user', 'scheme', 'password'),
 
1433
        conf.set_credentials('name2', 'host', 'user2', 'scheme', 'password'),
 
1434
        self.assertIs(None, conf._get_config().get('name'))
 
1435
        credentials = conf.get_credentials(host='host', scheme='scheme')
 
1436
        CREDENTIALS = {'name': 'name2', 'user': 'user2', 'password':
 
1437
                       'password', 'verify_certificates': True}
 
1438
        self.assertEqual(CREDENTIALS, credentials)
 
1439
 
 
1440
 
1415
1441
class TestAuthenticationConfig(tests.TestCase):
1416
1442
    """Test AuthenticationConfig behaviour"""
1417
1443