Esempio n. 1
0
 def test_BranchRenaming_TargetBranchExist_ShouldBeSuccessful(self):
     with testhelper.createrepo(folderprefix="gitfunctionstestcase_"):
         branchname = "hello"
         Commiter.branch(branchname)
         self.assertEqual(0, Commiter.promotebranchtomaster(branchname))
         time.sleep(1)
         self.assertEqual(0, Commiter.promotebranchtomaster(branchname))
Esempio n. 2
0
    def test_ExistingFileStartsWithUpperCase_RenameToLowerCase_ExpectGitRename(self):
        with testhelper.createrepo(folderprefix="gitfunctionstestcase_"):
            originalfilename = "AFileWithLowerStart"
            newfilename = "aFileWithLowerStart"

            self.simulateCreationAndRenameInGitRepo(originalfilename, newfilename)
            self.assertGitStatusShowsIsRenamed()
Esempio n. 3
0
 def test_IllegalGitCharsShouldntCreateFile_SpecialCaseAlreadyQuoted(self):
     with testhelper.createrepo(folderprefix="gitfunctionstestcase_"):
         Commiter.addandcommit(
             testhelper.createchangeentry(comment="Check out \"" + ">" +
                                          "\"US3333\""))
         self.assertEqual(0, len(shell.getoutput("git status -z")),
                          "No file should be created by commit message")
Esempio n. 4
0
 def test_BranchRenaming_TwoCallsAtTheSameTime_ShouldFail(self, datetimemock):
     with testhelper.createrepo(folderprefix="gitfunctionstestcase_"):
         branchname = "hello"
         Commiter.branch(branchname)
         faketime = datetime.datetime(2015, 11, 11, 11, 11, 11)
         datetimemock.now.return_value = faketime
         self.assertEqual(0, Commiter.promotebranchtomaster(branchname))
         self.assertEqual(1, Commiter.promotebranchtomaster(branchname))
Esempio n. 5
0
    def test_ExistingDirStartsWithUpperCaseA_RenameChildFile_ExpectGitRename(self):
        with testhelper.createrepo(folderprefix="gitfunctionstestcase_"):
            originalfilename = "AFileWithLowerStart"
            newfilename = "aFileWithLowerStart"
            subfolder = "Afolder"  # this is key to reproduce #39
            create_and_change_directory(subfolder)

            self.simulateCreationAndRenameInGitRepo(originalfilename, newfilename)
            self.assertGitStatusShowsIsRenamed()
Esempio n. 6
0
 def testExistRepo_Exists_ShouldReturnTrue(self):
     with testhelper.createrepo(folderprefix="test_migration"):
         self.assertTrue(migration.existsrepo())
Esempio n. 7
0
 def test_IllegalGitCharsShouldntCreateFile_SpecialCaseAlreadyQuoted(self):
     with testhelper.createrepo(folderprefix="gitfunctionstestcase_"):
         Commiter.addandcommit(testhelper.createchangeentry(comment="Check out \"" + ">" + "\"US3333\""))
         self.assertEqual(0, len(shell.getoutput("git status -z")), "No file should be created by commit message")
Esempio n. 8
0
 def test_IllegalGitCharsShouldntCreateFile_NoCommentCase(self):
     with testhelper.createrepo(folderprefix="gitfunctionstestcase_"):
         Commiter.addandcommit(testhelper.createchangeentry(comment="<No Comment>"))
         self.assertEqual(0, len(shell.getoutput("git status -z")), "No file should be created by commit message")
Esempio n. 9
0
 def test_checkbranchname_unquoted_expect_invalid(self):
     with testhelper.createrepo(folderprefix="gitfunctionstestcase_"):
         self.assertEqual(False, Commiter.checkbranchname("master pflaster"),
                          "master pflaster should not be a valid branch name")
Esempio n. 10
0
 def test_checkbranchname_expect_valid(self):
     with testhelper.createrepo(folderprefix="gitfunctionstestcase_"):
         self.assertEqual(True, Commiter.checkbranchname("master"), "master should be a valid branch name")
Esempio n. 11
0
 def test_CopyBranch_TargetAlreadyExist_ShouldFail(self):
     with testhelper.createrepo(folderprefix="gitfunctionstestcase_"):
         branchname = "hello"
         Commiter.branch(branchname)
         self.assertFalse(Commiter.copybranch("master", branchname) is 0)
Esempio n. 12
0
 def test_CopyBranch_TargetDoesntExist_ShouldBeSucessful(self):
     with testhelper.createrepo(folderprefix="gitfunctionstestcase_"):
         branchname = "hello"
         self.assertEqual(0, Commiter.copybranch("master", branchname))
Esempio n. 13
0
 def test_BranchRenaming_TargetBranchDoesntExist(self):
     with testhelper.createrepo(folderprefix="gitfunctionstestcase_"):
         branchname = "hello"
         Commiter.branch(branchname)
         self.assertEqual(0, Commiter.promotebranchtomaster(branchname))