@@ -11,40 +11,69 @@ class Test_Branch(unittest.TestCase):
1111 ''' the test branch '''
1212
1313 _git = None
14+ _branch = None
1415
1516 @classmethod
1617 def setUpClass (cls ):
1718 print ("...the set up..." )
1819 print ('' )
1920 cls ._git = Git ()
2021 cls ._git .config ()
22+ cls ._branch = Branch ()
2123
2224 def setUp (self ):
2325 super (Test_Branch , self ).setUp ()
2426
25- def test_get_branch (self ):
26- branch = Branch ()
27- branch_name = branch .get_branch ()
28- logging .info (branch_name )
29- self .assertIsNotNone (branch_name , 'test_get_branch is error.' )
30- print ("the test get_branch is succeed." )
27+ def test_0_get_branch (self ):
28+ branch_name = Test_Branch ._branch .get_branch ()
29+ logging .info ('the current branch name is {}' .format (branch_name ))
30+ self .assertIsNotNone (branch_name , 'test_0_get_branch is error.' )
31+ # print("the test get_branch is succeed.")
3132
32- def test_branch_to_file_and_commit_list (self ):
33- branch = Branch ()
34- branch_commit_list = branch .branch_to_file_and_commit_list ()
33+ def test_1_branch_to_file_and_commit_list (self ):
34+ branch_commit_list = Test_Branch ._branch .branch_to_file_and_commit_list ()
3535 logging .info (branch_commit_list )
3636 self .assertIsNotNone (branch_commit_list ,
37- 'test_branch_to_file_and_commit_list is error.' )
38- print ("the test branch_to_file_and_commit_list is succeed." )
37+ 'test_0_branch_to_file_and_commit_list is error.' )
38+ # print("the test branch_to_file_and_commit_list is succeed.")
3939
40- def test_branch_to_file_and_commit_list_with_more (self ):
41- branch = Branch ()
42- branch_commit_list_more = branch .branch_to_file_and_commit_list_with_more ()
40+ def test_2_branch_to_file_and_commit_list_with_more (self ):
41+ branch_commit_list_more = Test_Branch ._branch .branch_to_file_and_commit_list_with_more ()
4342 logging .info (branch_commit_list_more )
4443 self .assertIsNotNone (
4544 branch_commit_list_more ,
46- 'test_branch_to_file_and_commit_list_with_more is error.' )
47- print ("the test branch_to_file_and_commit_list_with_more is succeed." )
45+ 'test_0_branch_to_file_and_commit_list_with_more is error.' )
46+ # print("the test branch_to_file_and_commit_list_with_more is succeed.")
47+
48+ def test_3_branch_set_upstream_to (self ):
49+ branch_name = Test_Branch ._branch .get_branch ()
50+ # branch_name = None
51+ # branch_name = ''
52+ # branch_name = ' '
53+ # branch_name = '0'
54+ branch_set_upstream_to = Test_Branch ._branch .branch_set_upstream_to (branch_name )
55+ if branch_set_upstream_to :
56+ logging .info (branch_set_upstream_to )
57+ self .assertIsNotNone (branch_set_upstream_to , 'test_3_branch_set_upstream_to is error.' )
58+
59+ def test_5_get_current_branch_name (self ):
60+ branch_name = Test_Branch ._branch .get_branch ()
61+ # branch_name = None
62+ # branch_name = ''
63+ # branch_name = ' '
64+ # branch_name = '0'
65+ current_branch_name = Test_Branch ._branch .get_current_branch_name ()
66+ if current_branch_name :
67+ logging .info ('the current branch name is {0}.' .format (current_branch_name ))
68+ self .assertIsNotNone (current_branch_name , 'test_5_get_current_branch_name is error.' )
69+
70+ def test_4_set_current_branch_name (self ):
71+ branch_name = Test_Branch ._branch .get_branch ()
72+ # branch_name = None
73+ # branch_name = ''
74+ # branch_name = ' '
75+ # branch_name = '0'
76+ Test_Branch ._branch .set_current_branch_name (branch_name )
4877
4978 def tearDown (self ):
5079 super (Test_Branch , self ).tearDown ()
@@ -56,4 +85,5 @@ def tearDownClass(cls):
5685
5786
5887if __name__ == '__main__' :
59- unittest .main ()
88+ suite = unittest .TestLoader ().loadTestsFromTestCase (Test_Branch )
89+ unittest .TextTestRunner (verbosity = 2 ).run (suite )
0 commit comments