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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
18
"""Tests for finding and reading the bzr config file[s]."""
19
19
# import system imports here
1430
1427
def test_set_credentials(self):
1431
1428
conf = config.AuthenticationConfig()
1432
1429
conf.set_credentials('name', 'host', 'user', 'scheme', 'password',
1433
99, path='/foo', verify_certificates=False, realm='realm')
1430
99, path='/foo', verify_certificates=False)
1434
1431
credentials = conf.get_credentials(host='host', scheme='scheme',
1435
port=99, path='/foo',
1432
port=99, path='/foo')
1437
1433
CREDENTIALS = {'name': 'name', 'user': 'user', 'password': 'password',
1438
'verify_certificates': False, 'scheme': 'scheme',
1439
'host': 'host', 'port': 99, 'path': '/foo',
1434
'verify_certificates': False,}
1441
1435
self.assertEqual(CREDENTIALS, credentials)
1442
1436
credentials_from_disk = config.AuthenticationConfig().get_credentials(
1443
host='host', scheme='scheme', port=99, path='/foo', realm='realm')
1437
host='host', scheme='scheme', port=99, path='/foo')
1444
1438
self.assertEqual(CREDENTIALS, credentials_from_disk)
1446
1440
def test_reset_credentials_different_name(self):
1450
1444
self.assertIs(None, conf._get_config().get('name'))
1451
1445
credentials = conf.get_credentials(host='host', scheme='scheme')
1452
1446
CREDENTIALS = {'name': 'name2', 'user': 'user2', 'password':
1453
'password', 'verify_certificates': True,
1454
'scheme': 'scheme', 'host': 'host', 'port': None,
1455
'path': None, 'realm': None}
1447
'password', 'verify_certificates': True}
1456
1448
self.assertEqual(CREDENTIALS, credentials)