blob: d67a8babf079218b781d57903f42aa4a8edfbdfc [file] [log] [blame]
David Aguilar438c5472009-06-28 15:09:16 -07001import os
2import unittest
3
4import git_config
5
6def fixture(*paths):
7 """Return a path relative to test/fixtures.
8 """
9 return os.path.join(os.path.dirname(__file__), 'fixtures', *paths)
10
11class GitConfigUnitTest(unittest.TestCase):
12 """Tests the GitConfig class.
13 """
14 def setUp(self):
15 """Create a GitConfig object using the test.gitconfig fixture.
16 """
17 config_fixture = fixture('test.gitconfig')
18 self.config = git_config.GitConfig(config_fixture)
19
20 def test_GetString_with_empty_config_values(self):
21 """
22 Test config entries with no value.
23
24 [section]
25 empty
26
27 """
28 val = self.config.GetString('section.empty')
29 self.assertEqual(val, None)
30
31 def test_GetString_with_true_value(self):
32 """
33 Test config entries with a string value.
34
35 [section]
36 nonempty = true
37
38 """
39 val = self.config.GetString('section.nonempty')
40 self.assertEqual(val, 'true')
41
42if __name__ == '__main__':
43 unittest.main()