14
14
# You should have received a copy of the GNU General Public License
15
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
18
"""Tests for finding and reading the bzr config file[s]."""
19
19
# import system imports here
1427
1427
def test_set_credentials(self):
1428
1428
conf = config.AuthenticationConfig()
1429
1429
conf.set_credentials('name', 'host', 'user', 'scheme', 'password',
1430
99, path='/foo', verify_certificates=False)
1430
99, path='/foo', verify_certificates=False, realm='realm')
1431
1431
credentials = conf.get_credentials(host='host', scheme='scheme',
1432
port=99, path='/foo')
1432
port=99, path='/foo',
1433
1434
CREDENTIALS = {'name': 'name', 'user': 'user', 'password': 'password',
1434
'verify_certificates': False,}
1435
'verify_certificates': False, 'scheme': 'scheme',
1436
'host': 'host', 'port': 99, 'path': '/foo',
1435
1438
self.assertEqual(CREDENTIALS, credentials)
1436
1439
credentials_from_disk = config.AuthenticationConfig().get_credentials(
1437
host='host', scheme='scheme', port=99, path='/foo')
1440
host='host', scheme='scheme', port=99, path='/foo', realm='realm')
1438
1441
self.assertEqual(CREDENTIALS, credentials_from_disk)
1440
1443
def test_reset_credentials_different_name(self):
1444
1447
self.assertIs(None, conf._get_config().get('name'))
1445
1448
credentials = conf.get_credentials(host='host', scheme='scheme')
1446
1449
CREDENTIALS = {'name': 'name2', 'user': 'user2', 'password':
1447
'password', 'verify_certificates': True}
1450
'password', 'verify_certificates': True,
1451
'scheme': 'scheme', 'host': 'host', 'port': None,
1452
'path': None, 'realm': None}
1448
1453
self.assertEqual(CREDENTIALS, credentials)