~bzr/bzr/bzr.1.5

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_config.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-05-09 22:26:18 UTC
  • mfrom: (3418.2.4 +trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20080509222618-5za5xl5xvzec8d6r
Merge the latest bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1195
1195
        self.assertEquals({}, conf._get_config())
1196
1196
        self._got_user_passwd(None, None, conf, 'http', 'foo.net')
1197
1197
 
1198
 
    def test_broken_config(self):
 
1198
    def test_missing_auth_section_header(self):
 
1199
        conf = config.AuthenticationConfig(_file=StringIO('foo = bar'))
 
1200
        self.assertRaises(ValueError, conf.get_credentials, 'ftp', 'foo.net')
 
1201
 
 
1202
    def test_auth_section_header_not_closed(self):
1199
1203
        conf = config.AuthenticationConfig(_file=StringIO('[DEF'))
1200
1204
        self.assertRaises(errors.ParseConfigError, conf._get_config)
1201
1205
 
 
1206
    def test_auth_value_not_boolean(self):
1202
1207
        conf = config.AuthenticationConfig(_file=StringIO(
1203
1208
                """[broken]
1204
1209
scheme=ftp
1206
1211
verify_certificates=askme # Error: Not a boolean
1207
1212
"""))
1208
1213
        self.assertRaises(ValueError, conf.get_credentials, 'ftp', 'foo.net')
 
1214
 
 
1215
    def test_auth_value_not_int(self):
1209
1216
        conf = config.AuthenticationConfig(_file=StringIO(
1210
1217
                """[broken]
1211
1218
scheme=ftp
1330
1337
        self._got_user_passwd(None, None,
1331
1338
                              conf, 'http', 'bar.org', user='georges')
1332
1339
 
 
1340
    def test_credentials_for_user_without_password(self):
 
1341
        conf = config.AuthenticationConfig(_file=StringIO(
 
1342
                """
 
1343
[without password]
 
1344
scheme=http
 
1345
host=bar.org
 
1346
user=jim
 
1347
"""))
 
1348
        # Get user but no password
 
1349
        self._got_user_passwd('jim', None,
 
1350
                              conf, 'http', 'bar.org')
 
1351
 
1333
1352
    def test_verify_certificates(self):
1334
1353
        conf = config.AuthenticationConfig(_file=StringIO(
1335
1354
                """