~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_config.py

  • Committer: Martin Pool
  • Date: 2008-10-20 08:09:33 UTC
  • mto: This revision was merged to the branch mainline in revision 3787.
  • Revision ID: mbp@sourcefrog.net-20081020080933-xba7zw9ffozm6brl
Build zip file from 'make dist' and document this; also tweak standard announcement mail

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006, 2008 Canonical Ltd
 
1
# Copyright (C) 2005, 2006 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
 
 
1441
1415
class TestAuthenticationConfig(tests.TestCase):
1442
1416
    """Test AuthenticationConfig behaviour"""
1443
1417