use of com.thoughtworks.go.domain.SecretConfigUsage in project gocd by gocd.
the class SecretConfigDeleteCommandTest method shouldNotValidateIfSecretConfigIsInUseByPipeline.
@Test
public void shouldNotValidateIfSecretConfigIsInUseByPipeline() {
SecretConfig secretConfig = new SecretConfig("foo", "file-based");
Set<SecretConfigUsage> usageInfo = new HashSet<>(Arrays.asList(new SecretConfigUsage("gocd", "P1", "S1", "J1", "template1")));
SecretConfigDeleteCommand command = new SecretConfigDeleteCommand(null, secretConfig, usageInfo, null, null, new HttpLocalizedOperationResult());
GoConfigInvalidException goConfigInvalidException = assertThrows(GoConfigInvalidException.class, () -> {
command.isValid(cruiseConfig);
});
assertThat(goConfigInvalidException.getMessage(), is("The secret config 'foo' is being referenced by pipeline(s): P1."));
}
Aggregations