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))
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))
def test_BranchRenaming_TargetBranchDoesntExist(self): with testhelper.createrepo(folderprefix="gitfunctionstestcase_"): branchname = "hello" Commiter.branch(branchname) self.assertEqual(0, Commiter.promotebranchtomaster(branchname))