/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/tests/test_config.py

Merge bzr.dev

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
1422
1422
        self.assertEquals(True, credentials.get('verify_certificates'))
1423
1423
 
1424
1424
 
 
1425
class TestAuthenticationStorage(tests.TestCaseInTempDir):
 
1426
 
 
1427
    def test_set_credentials(self):
 
1428
        conf = config.AuthenticationConfig()
 
1429
        conf.set_credentials('name', 'host', 'user', 'scheme', 'password',
 
1430
        99, path='/foo', verify_certificates=False)
 
1431
        credentials = conf.get_credentials(host='host', scheme='scheme',
 
1432
                                           port=99, path='/foo')
 
1433
        CREDENTIALS = {'name': 'name', 'user': 'user', 'password': 'password',
 
1434
                       'verify_certificates': False,}
 
1435
        self.assertEqual(CREDENTIALS, credentials)
 
1436
        credentials_from_disk = config.AuthenticationConfig().get_credentials(
 
1437
            host='host', scheme='scheme', port=99, path='/foo')
 
1438
        self.assertEqual(CREDENTIALS, credentials_from_disk)
 
1439
 
 
1440
    def test_reset_credentials_different_name(self):
 
1441
        conf = config.AuthenticationConfig()
 
1442
        conf.set_credentials('name', 'host', 'user', 'scheme', 'password'),
 
1443
        conf.set_credentials('name2', 'host', 'user2', 'scheme', 'password'),
 
1444
        self.assertIs(None, conf._get_config().get('name'))
 
1445
        credentials = conf.get_credentials(host='host', scheme='scheme')
 
1446
        CREDENTIALS = {'name': 'name2', 'user': 'user2', 'password':
 
1447
                       'password', 'verify_certificates': True}
 
1448
        self.assertEqual(CREDENTIALS, credentials)
 
1449
 
 
1450
 
1425
1451
class TestAuthenticationConfig(tests.TestCase):
1426
1452
    """Test AuthenticationConfig behaviour"""
1427
1453