def test_RetryAccept_NotSuccessful_AndExit(self, exitmock, inputmock, shellmock): component1 = "uuid1" component2 = "uuid2" changeentry1 = testhelper.createchangeentry(revision="anyRevId", component=component1) changeentry2 = testhelper.createchangeentry(revision="component2RevId", component=component2) changeentry3 = testhelper.createchangeentry(revision="anyOtherRevId", component=component1) changeentry3.setAccepted() changeentries = [changeentry1, changeentry2, changeentry3] self.configBuilder.setrepourl( "anyurl").setuseautomaticconflictresolution( "True").setmaxchangesetstoaccepttogether(10).setworkspace( "anyWs") config = self.configBuilder.build() configuration.config = config handler = ImportHandler() handler.retryacceptincludingnextchangesets(changeentry1, changeentries) inputmock.assert_called_once_with( 'Do you want to continue? Y for continue, any key for abort') exitmock.assert_called_once_with( "Please check the output/log and rerun program with resume")
def test_RetryAccept_AssertThatOnlyChangesFromSameComponentGetAcceptedTogether( self, inputmock, shellmock): component1 = "uuid1" component2 = "uuid2" changeentry1 = testhelper.createchangeentry(revision="anyRevId", component=component1) changeentry2 = testhelper.createchangeentry(revision="component2RevId", component=component2) changeentry3 = testhelper.createchangeentry(revision="anyOtherRevId", component=component1) changeentries = [changeentry1, changeentry2, changeentry3] shellmock.execute.return_value = 0 self.configBuilder.setrepourl( "anyurl").setuseautomaticconflictresolution( "True").setmaxchangesetstoaccepttogether(10).setworkspace( "anyWs") config = self.configBuilder.build() configuration.config = config handler = ImportHandler() handler.retryacceptincludingnextchangesets(changeentry1, changeentries) expectedshellcommand = 'lscm accept --verbose --overwrite-uncommitted --accept-missing-changesets --no-merge --repository-uri anyurl --target anyWs --changes anyRevId anyOtherRevId' shellmock.execute.assert_called_once_with( expectedshellcommand, handler.config.getlogpath("accept.txt"), "a")
def test_RetryAccept_AssertThatTwoChangesGetAcceptedTogether( self, inputmock, shellmock): changeentry1 = self.createChangeEntry("anyRevId") changeentry2 = self.createChangeEntry("anyOtherRevId") changeentries = [changeentry1, changeentry2] shellmock.execute.return_value = 0 self.configBuilder.setrepourl( "anyurl").setuseautomaticconflictresolution("True").setworkspace( "anyWs") config = self.configBuilder.build() handler = ImportHandler(config) handler.retryacceptincludingnextchangesets(changeentry1, changeentries) expectedshellcommand = 'lscm accept -v -o -r anyurl -t anyWs --changes anyRevId anyOtherRevId' shellmock.execute.assert_called_once_with( expectedshellcommand, handler.config.getlogpath("accept.txt"), "a")