@Test public void shouldDeleteTemplateFromTheGivenConfig() throws Exception { cruiseConfig.addTemplate(pipelineTemplateConfig); DeleteTemplateConfigCommand command = new DeleteTemplateConfigCommand( pipelineTemplateConfig, result, goConfigService, currentUser); assertThat(cruiseConfig.getTemplates().contains(pipelineTemplateConfig), is(true)); command.update(cruiseConfig); assertThat(cruiseConfig.getTemplates().contains(pipelineTemplateConfig), is(false)); }
@Test public void shouldContinueWithConfigSaveIfUserIsAuthorized() { cruiseConfig.addTemplate(pipelineTemplateConfig); when(goConfigService.isUserAdmin(currentUser)).thenReturn(true); DeleteTemplateConfigCommand command = new DeleteTemplateConfigCommand( pipelineTemplateConfig, result, goConfigService, currentUser); assertThat(command.canContinue(cruiseConfig), is(true)); }