annotate tests/test-config.py @ 124:cc7569bffb26

context: add 'hidden' method to check if the changeset is hidden This method should not be a static property obtained at creation as the hidden status may change.
author Paul Tonelli <paul.tonelli@logilab.fr>
date Thu, 15 May 2014 15:12:13 +0200
parents e738d6fe5f3f
children 9ecb271600fc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
21
ffef7df076e8 client: rewrite config()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
1 import os, common, hglib
ffef7df076e8 client: rewrite config()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
2
ffef7df076e8 client: rewrite config()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
3 class test_config(common.basetest):
ffef7df076e8 client: rewrite config()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
4 def setUp(self):
ffef7df076e8 client: rewrite config()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
5 common.basetest.setUp(self)
118
e738d6fe5f3f tests: make the tests work under Pypy (issue3965)
Matt Mackall <mpm@selenic.com>
parents: 21
diff changeset
6 f = open('.hg/hgrc', 'a')
e738d6fe5f3f tests: make the tests work under Pypy (issue3965)
Matt Mackall <mpm@selenic.com>
parents: 21
diff changeset
7 f.write('[section]\nkey=value\n')
e738d6fe5f3f tests: make the tests work under Pypy (issue3965)
Matt Mackall <mpm@selenic.com>
parents: 21
diff changeset
8 f.close()
21
ffef7df076e8 client: rewrite config()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
9 self.client = hglib.open()
ffef7df076e8 client: rewrite config()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
10
ffef7df076e8 client: rewrite config()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
11 def test_basic(self):
ffef7df076e8 client: rewrite config()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
12 config = self.client.config()
ffef7df076e8 client: rewrite config()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
13
ffef7df076e8 client: rewrite config()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
14 self.assertTrue(('section', 'key', 'value') in self.client.config())
ffef7df076e8 client: rewrite config()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
15
ffef7df076e8 client: rewrite config()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
16 self.assertTrue([('section', 'key', 'value')],
ffef7df076e8 client: rewrite config()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
17 self.client.config('section'))
ffef7df076e8 client: rewrite config()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
18 self.assertTrue([('section', 'key', 'value')],
ffef7df076e8 client: rewrite config()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
19 self.client.config(['section', 'foo']))
ffef7df076e8 client: rewrite config()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
20 self.assertRaises(hglib.error.CommandError,
ffef7df076e8 client: rewrite config()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
21 self.client.config, ['a.b', 'foo'])
ffef7df076e8 client: rewrite config()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
22
ffef7df076e8 client: rewrite config()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
23 def test_show_source(self):
ffef7df076e8 client: rewrite config()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
24 config = self.client.config(showsource=True)
ffef7df076e8 client: rewrite config()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
25
ffef7df076e8 client: rewrite config()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
26 self.assertTrue((os.path.abspath('.hg/hgrc') + ':2',
ffef7df076e8 client: rewrite config()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
27 'section', 'key', 'value') in config)