/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

  • Committer: Andrew Bennetts
  • Date: 2009-07-17 01:48:56 UTC
  • mfrom: (4543 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4545.
  • Revision ID: andrew.bennetts@canonical.com-20090717014856-c8igd2f9abbi3v30
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
"""Tests for finding and reading the bzr config file[s]."""
19
19
# import system imports here
20
20
from cStringIO import StringIO
21
 
import getpass
22
21
import os
23
22
import sys
24
23
 
368
367
        parser = my_config._get_parser(file=config_file)
369
368
        self.failUnless(my_config._get_parser() is parser)
370
369
 
 
370
    def test_get_user_option_as_bool(self):
 
371
        config_file = StringIO("""
 
372
a_true_bool = true
 
373
a_false_bool = 0
 
374
an_invalid_bool = maybe
 
375
a_list = hmm, who knows ? # This interpreted as a list !
 
376
""".encode('utf-8'))
 
377
        my_config = config.IniBasedConfig(None)
 
378
        parser = my_config._get_parser(file=config_file)
 
379
        get_option = my_config.get_user_option_as_bool
 
380
        self.assertEqual(True, get_option('a_true_bool'))
 
381
        self.assertEqual(False, get_option('a_false_bool'))
 
382
        self.assertIs(None, get_option('an_invalid_bool'))
 
383
        self.assertIs(None, get_option('not_defined_in_this_config'))
371
384
 
372
385
class TestGetConfig(tests.TestCase):
373
386