def test_use_http(self): # If use_http=True is passed to interpret_config, all lp: branch # URLs will be transformed into http:// URLs. config = interpret_config( [['key', 'lp:~sabdfl/foo/trunk']], False, use_http=True) expected_url = 'http://bazaar.launchpad.net/~sabdfl/foo/trunk' self.assertEqual(expected_url, config['key'][0])
def test_key_value_revision(self): # A (key, value) pair without a third optional value when the # value has a suffix of ``;revno=[REVISION]`` is returned in the # configuration as a dictionary entry under 'key' with '(value, # None, False)' as its value. config = interpret_config([['key', 'value;revno=45']], False) self.assertEqual({'key': ('value', '45', False)}, config)
def test_smoke_the_default_config(self): # Make sure we can parse, interpret and plan based on the default # config file. root = get_launchpad_root() config_filename = os.path.join(root, 'utilities', 'sourcedeps.conf') config_file = open(config_filename) config = interpret_config(parse_config_file(config_file), False) config_file.close() plan_update([], config)
def test_key_value_optional_public_only(self): # A (key, value, optional) entry is not returned in the configuration # when public_only is true. config = interpret_config([['key', 'value', 'optional']], True) self.assertEqual({}, config)
def test_key_value_optional(self): # A (key, value, optional) entry is returned in the configuration as a # dictionary entry under 'key' with '(value, True)' as its value. config = interpret_config([['key', 'value', 'optional']], False) self.assertEqual({'key': ('value', None, True)}, config)
def test_key_value_public_only(self): # A (key, value) pair without a third optional value is returned in # the configuration as a dictionary entry under 'key' with '(value, # None, False)' as its value when public_only is true. config = interpret_config([['key', 'value']], True) self.assertEqual({'key': ('value', None, False)}, config)
def test_empty(self): # An empty configuration stream means no configuration. config = interpret_config([], False) self.assertEqual({}, config)