4 from cola
import gitcfg
7 class GitConfigTestCase(helper
.GitRepositoryTestCase
):
8 """Tests the cola.gitcmds module."""
10 helper
.GitRepositoryTestCase
.setUp(self
)
11 self
.config
= gitcfg
.instance()
13 def test_string(self
):
14 """Test string values in get()."""
15 self
.shell('git config test.value test')
16 self
.assertEqual(self
.config
.get('test.value'), 'test')
19 """Test int values in get()."""
20 self
.shell('git config test.int 42')
21 self
.assertEqual(self
.config
.get('test.int'), 42)
24 """Test bool values in get()."""
25 self
.shell('git config test.bool true')
26 self
.assertEqual(self
.config
.get('test.bool'), True)
27 self
.shell('git config test.bool false')
28 self
.assertEqual(self
.config
.get('test.bool'), False)
30 def test_default(self
):
31 """Test default values in get()."""
32 self
.assertEqual(self
.config
.get('does.not.exist'), None)
33 self
.assertEqual(self
.config
.get('does.not.exist', default
=42), 42)
36 if __name__
== '__main__':