controllers: rename "find" to "search" in prep for search menu work
[ugit.git] / t / t0003-git-ops.py
blobcf7f45af26cc33849371cd8c81867d09117b883a
1 #!/usr/bin/env python
2 import os
3 import unittest
5 import testutils
6 from testutils import pipe
8 from ugit import git
10 class GitOpsTest(testutils.TestCase):
11 def testCommit(self):
12 self.shell("""
13 echo A > A
14 echo B > B
15 git init 2>&1 >/dev/null
16 git add A B
17 """)
18 git.commit(m="commit test")
19 log = pipe("git log --pretty=oneline | wc -l")
21 self.failUnless( '1' == log )
23 def testConfig(self):
24 self.shell("""
25 git init 2>&1 >/dev/null
26 git config section.key value
27 """)
28 value = git.config('section.key', get=True)
30 self.failUnless( value == 'value' )
32 # Test config_set
33 git.config_set('section.bool', True)
34 value = git.config('section.bool', get=True)
36 self.failUnless( value == 'true' )
37 git.config_set('section.bool', False)
39 # Test config_dict
40 config_dict = git.config_dict(local=True)
42 self.failUnless( config_dict['section_key'] == 'value' )
43 self.failUnless( config_dict['section_bool'] == False )
45 # Test config_dict --global
46 global_dict = git.config_dict(local=False)
48 self.failUnless( type(global_dict) is dict )
50 if __name__ == '__main__':
51 unittest.main()