win32: Launching executables (diff editor, editor, etc.) was busted on Windows
[git-cola.git] / test / test_git_opts.py
blob4d166696ed7a508c82f398805e6287be4563273c
1 #!/usr/bin/env python
2 import os
3 import unittest
5 import testlib
6 from cola import models
8 class GitOpsTest(testlib.TestCase):
10 def testCommit(self):
11 self.shell("""
12 echo A > A
13 echo B > B
14 git init 2>&1 > /dev/null
15 git add A B
16 """)
18 model = models.Model()
19 model.git.commit(m="commit test")
20 log = testlib.pipe("git log --pretty=oneline | wc -l")
22 self.failUnless('1' == log)
24 def testConfig(self):
25 self.shell("""
26 git init 2>&1 >/dev/null
27 git config section.key value
28 """)
29 model = models.Model()
30 value = model.git.config('section.key', get=True)
32 self.failUnless(value == 'value')
34 # Test config_set
35 model.config_set('section.bool', True)
36 value = model.git.config('section.bool', get=True)
38 self.failUnless(value == 'true')
39 model.config_set('section.bool', False)
41 # Test config_dict
42 config_dict = model.config_dict(local=True)
44 self.failUnless( config_dict['section_key'] == 'value' )
45 self.failUnless( config_dict['section_bool'] == False )
47 # Test config_dict --global
48 global_dict = model.config_dict(local=False)
50 self.failUnless(type(global_dict) is dict)
52 if __name__ == '__main__':
53 unittest.main()