Revert "Update integration test webhook to GerritForge channel"
The use of an existing Slack channel for integration tests
is flagged by Slack as a security threat and isn't allowed.
The integration test remains but would need to be run manually
once a dedicated temporary channel can accept the calls and then
be removed.
This reverts commit 534fa02df3e67f64bb5e6d142be1a84bbac4a8b4.
Change-Id: I3e562af31b0637c3cf4f7fec6464b56ed133f3d0
diff --git a/src/test/java/com/cisco/gerrit/plugins/slack/client/WebhookClientIntegrationTest.java b/src/test/java/com/cisco/gerrit/plugins/slack/client/WebhookClientIntegrationTest.java
index 2d566fc..67c8097 100644
--- a/src/test/java/com/cisco/gerrit/plugins/slack/client/WebhookClientIntegrationTest.java
+++ b/src/test/java/com/cisco/gerrit/plugins/slack/client/WebhookClientIntegrationTest.java
@@ -18,6 +18,7 @@
package com.cisco.gerrit.plugins.slack.client;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeNotNull;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -60,14 +61,17 @@
@Test
public void canPublishMessage() throws Exception {
- WebhookClient client;
- client = new WebhookClient(getConfig());
-
Properties properties = new Properties();
try (InputStream testProperties = ResourceHelper.loadNamedResourceAsStream("test.properties")) {
properties.load(testProperties);
}
+ String webhookUrl = properties.getProperty("webhook-url");
+ assumeNotNull(webhookUrl);
+
+ WebhookClient client;
+ client = new WebhookClient(getConfig());
+
MessageTemplate template;
template = new MessageTemplate();
@@ -80,9 +84,6 @@
template.setNumber(1234);
template.setTitle("Adds a test commit message");
- String webhookUrl;
- webhookUrl = properties.getProperty("webhook-url");
-
assertTrue(client.publish(template.render(), webhookUrl));
}
@@ -96,6 +97,9 @@
properties.load(testProperties);
}
+ String webhookUrl = properties.getProperty("webhook-url");
+ assumeNotNull(webhookUrl);
+
MessageTemplate template;
template = new MessageTemplate();
@@ -114,9 +118,6 @@
+ "but this will be on multiple lines in IRC.\n\n\n\n\n"
+ "This is hidden.");
- String webhookUrl;
- webhookUrl = properties.getProperty("webhook-url");
-
assertTrue(client.publish(template.render(), webhookUrl));
}
}
diff --git a/src/test/resources/test.properties b/src/test/resources/test.properties
index e2f5f5a..92ca845 100644
--- a/src/test/resources/test.properties
+++ b/src/test/resources/test.properties
@@ -15,4 +15,3 @@
#
#
-webhook-url=https://hooks.slack.com/services/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