def test_Discard_AssertThatCorrectParamaterGetPassedToShell( self, shell_mock): revision1 = "anyRevision" revision2 = "anyOtherRevision" anyurl = "anyUrl" config = self.configBuilder.setrepourl(anyurl).setworkspace( self.workspace).build() Changes.discard(config, self.createChangeEntry(revision1), self.createChangeEntry(revision2)) expected_discard_command = "lscm discard -w %s -r %s -o %s %s" % ( self.workspace, anyurl, revision1, revision2) shell_mock.execute.assert_called_once_with(expected_discard_command)
def test_Accept_AssertThatChangeEntriesGetAccepted(self): with patch.object(shell, 'execute', return_value=0) as shell_mock: revision1 = "anyRevision" revision2 = "anyOtherRevision" anyurl = "anyUrl" config = self.configBuilder.setrepourl(anyurl).setworkspace( self.workspace).build() configuration.config = config changeentry1 = testhelper.createchangeentry(revision1) changeentry2 = testhelper.createchangeentry(revision2) Changes.accept(self.apath, changeentry1, changeentry2) self.assertTrue(changeentry1.isAccepted()) self.assertTrue(changeentry1.isAccepted())
def test_Accept_AssertThatCorrectParamaterGetPassedToShell( self, shell_mock): revision1 = "anyRevision" revision2 = "anyOtherRevision" anyurl = "anyUrl" config = self.configBuilder.setrepourl(anyurl).setworkspace( self.workspace).build() Changes.accept(config, self.apath, self.createChangeEntry(revision1), self.createChangeEntry(revision2)) expected_accept_command = "lscm accept -v -o -r %s -t %s --changes %s %s" % ( anyurl, self.workspace, revision1, revision2) appendlogfileshortcut = "a" shell_mock.execute.assert_called_once_with(expected_accept_command, self.apath, appendlogfileshortcut) self.assertEqual(expected_accept_command, Changes.latest_accept_command)
def test_Accept_AssertThatCorrectParamaterGetPassedToShell( self, shell_mock): revision1 = "anyRevision" revision2 = "anyOtherRevision" anyurl = "anyUrl" config = self.configBuilder.setrepourl(anyurl).setworkspace( self.workspace).build() configuration.config = config Changes.accept(self.apath, testhelper.createchangeentry(revision1), testhelper.createchangeentry(revision2)) commandtemplate = u"lscm accept --verbose --overwrite-uncommitted --accept-missing-changesets --no-merge --repository-uri {0:s} --target {1:s} --changes {2:s} {3:s}" expected_accept_command = commandtemplate.format( anyurl, self.workspace, revision1, revision2) appendlogfileshortcut = "a" shell_mock.execute.assert_called_once_with(expected_accept_command, self.apath, appendlogfileshortcut) self.assertEqual(expected_accept_command, Changes.latest_accept_command)