Skip to content

Commit

Permalink
#50 - Adding SlackPluginSettings + fixing the GoNotificationPluginTests
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwanthkumar committed Jul 5, 2016
1 parent aa03d1b commit 483a1bd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
13 changes: 13 additions & 0 deletions src/main/java/in/ashwanthkumar/gocd/slack/SlackPluginSettings.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package in.ashwanthkumar.gocd.slack;

import in.ashwanthkumar.gocd.slack.base.PluginConfig;

public class SlackPluginSettings {

@PluginConfig(id = "server-url-external", displayName = "External GoCD Server", displayOrder = 2)
private String externalServerUrl;

@PluginConfig(id = "pluginConfig", displayName = "Pipeline Notification Rules", displayOrder = 2)
private String pipelineConfig;

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class GoNotificationPluginTest {
public static final String USER_HOME = "user.home";

public static final String NOTIFICATION_INTEREST_RESPONSE = "{\"notifications\":[\"stage-status\"]}";
public static final String GET_CONFIGURATION_RESPONSE = "{\"pipelineConfig\":{\"display-name\":\"Pipeline Notification Rules\",\"display-order\":\"2\",\"display-value\":\"\",\"required\":true,\"secure\":false},\"server-url-external\":{\"display-name\":\"External GoCD Server URL\",\"display-order\":\"1\",\"display-value\":\"\",\"required\":true,\"secure\":false}}";
public static final String GET_CONFIGURATION_RESPONSE = "{\"pluginConfig\":{\"display-name\":\"Pipeline Notification Rules\",\"default-value\":\"\",\"display-order\":1,\"required\":false,\"secure\":false},\"server-url-external\":{\"display-name\":\"External GoCD Server\",\"default-value\":\"\",\"display-order\":1,\"required\":false,\"secure\":false}}";
private static final String GET_CONFIG_VALIDATION_RESPONSE = "[]";

@Test
Expand All @@ -42,6 +42,7 @@ public void canHandleConfigValidationRequest() {

@Test
public void canHandleConfigurationRequest() {
// TODO - Ignore this test - the JSON based assertion seems to be very flaky
GoNotificationPlugin plugin = createGoNotificationPluginFromConfigAtHomeDir();

GoPluginApiRequest request = mock(GoPluginApiRequest.class);
Expand All @@ -50,7 +51,7 @@ public void canHandleConfigurationRequest() {
GoPluginApiResponse rv = plugin.handle(request);

assertThat(rv, is(notNullValue()));
assertThat(rv.responseBody(), equalTo(GET_CONFIGURATION_RESPONSE));
assertThat(rv.responseBody(), is(GET_CONFIGURATION_RESPONSE));
}

@Test
Expand Down

0 comments on commit 483a1bd

Please sign in to comment.