use of com.thoughtworks.go.config.rules.Deny in project gocd by gocd.
the class MagicalGoConfigXmlLoaderTest method shouldLoadSecretConfigs.
@Test
void shouldLoadSecretConfigs() {
String content = config("<secretConfigs>" + "<secretConfig id=\"my_secret\" pluginId=\"gocd_file_based_plugin\">\n" + " <description>All secrets for env1</description>" + " <configuration>" + " <property>\n" + " <key>PasswordFilePath</key>\n" + " <value>/godata/config/password.properties</value>\n" + " </property>\n" + " </configuration>" + " <rules>\n" + " <deny action=\"refer\" type=\"pipeline_group\">my_group</deny>\n" + " <allow action=\"refer\" type=\"pipeline_group\">other_group</allow> \n" + " </rules>\n" + "</secretConfig>" + "</secretConfigs>", 116);
CruiseConfig config = ConfigMigrator.load(content);
SecretConfigs secretConfigs = config.getSecretConfigs();
assertThat(secretConfigs.size()).isEqualTo(1);
SecretConfig secretConfig = secretConfigs.first();
assertThat(secretConfig.getId()).isEqualTo("my_secret");
assertThat(secretConfig.getPluginId()).isEqualTo("gocd_file_based_plugin");
assertThat(secretConfig.getDescription()).isEqualTo("All secrets for env1");
Configuration configuration = secretConfig.getConfiguration();
assertThat(configuration.size()).isEqualTo(1);
assertThat(configuration.getProperty("PasswordFilePath").getValue()).isEqualTo("/godata/config/password.properties");
Rules rules = secretConfig.getRules();
assertThat(rules.size()).isEqualTo(2);
assertThat(rules).containsExactly(new Deny("refer", "pipeline_group", "my_group"), new Allow("refer", "pipeline_group", "other_group"));
}
Aggregations