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 resume(): shouter.shout("Found existing git repo in work directory, resuming migration...") config = configuration.get() os.chdir(config.workDirectory) os.chdir(config.clonedGitRepoName) if Differ.has_diff(): sys.exit("Your git repo has some uncommited changes, please add/remove them manually") RTCLogin.loginandcollectstreamuuid() Initializer.preparerepo() if config.previousstreamname: prepare() else: Commiter.branch(config.streamname)
def test_CopyBranch_TargetAlreadyExist_ShouldFail(self): with testhelper.createrepo(folderprefix="gitfunctionstestcase_"): branchname = "hello" Commiter.branch(branchname) self.assertFalse(Commiter.copybranch("master", branchname) is 0)
def test_BranchRenaming_TargetBranchDoesntExist(self): with testhelper.createrepo(folderprefix="gitfunctionstestcase_"): branchname = "hello" Commiter.branch(branchname) self.assertEqual(0, Commiter.promotebranchtomaster(branchname))