21
|
1 import os, common, hglib
|
|
2
|
|
3 class test_config(common.basetest):
|
|
4 def setUp(self):
|
|
5 common.basetest.setUp(self)
|
|
6 open('.hg/hgrc', 'a').write('[section]\nkey=value\n')
|
|
7 self.client = hglib.open()
|
|
8
|
|
9 def test_basic(self):
|
|
10 config = self.client.config()
|
|
11
|
|
12 self.assertTrue(('section', 'key', 'value') in self.client.config())
|
|
13
|
|
14 self.assertTrue([('section', 'key', 'value')],
|
|
15 self.client.config('section'))
|
|
16 self.assertTrue([('section', 'key', 'value')],
|
|
17 self.client.config(['section', 'foo']))
|
|
18 self.assertRaises(hglib.error.CommandError,
|
|
19 self.client.config, ['a.b', 'foo'])
|
|
20
|
|
21 def test_show_source(self):
|
|
22 config = self.client.config(showsource=True)
|
|
23
|
|
24 self.assertTrue((os.path.abspath('.hg/hgrc') + ':2',
|
|
25 'section', 'key', 'value') in config)
|