Skip to content

Commit

Permalink
Update tests for new Chime webhook regex.
Browse files Browse the repository at this point in the history
Signed-off-by: Aniruddh Srivastava <[email protected]>
  • Loading branch information
Noir01 committed Nov 20, 2023
1 parent 0d609ee commit 1a7bcfa
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ fun getCreateNotificationRequestJsonString(
"slack":{"url":"https://hooks.slack.com/services/sample_slack_url#$randomString"}
""".trimIndent()
ConfigType.CHIME -> """
"chime":{"url":"https://chime.domain.com/sample_chime_url#$randomString"}
"chime":{"url":"https://hooks.chime.aws/incomingwebhooks/sample_chime_url?token=$randomString"}
""".trimIndent()
ConfigType.MICROSOFT_TEAMS -> """
"microsoft_teams":{"url":"https://microsoftTeams.domain.webhook.office.com/sample_microsoft_teams_url#$randomString"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ChimeNotificationConfigCrudIT : PluginRestTestCase() {

fun `test Create, Get, Update, Delete chime notification config using REST client`() {
// Create sample config request reference
val sampleChime = Chime("https://domain.com/sample_chime_url#1234567890")
val sampleChime = Chime("https://hooks.chime.aws/incomingwebhooks/sample_chime_url?token=123456")
val referenceObject = NotificationConfig(
"this is a sample config name",
"this is a sample config description",
Expand Down Expand Up @@ -66,7 +66,7 @@ class ChimeNotificationConfigCrudIT : PluginRestTestCase() {
Thread.sleep(100)

// Updated notification config object
val updatedChime = Chime("https://updated.domain.com/updated_chime_url#0987654321")
val updatedChime = Chime("https://hooks.chime.aws/incomingwebhooks/sample_chime_url?token=654321")
val updatedObject = NotificationConfig(
"this is a updated config name",
"this is a updated config description",
Expand Down Expand Up @@ -125,7 +125,7 @@ class ChimeNotificationConfigCrudIT : PluginRestTestCase() {

fun `test BAD Request for multiple config data for Chime using REST Client`() {
// Create sample config request reference
val sampleChime = Chime("https://domain.com/sample_chime_url#1234567890")
val sampleChime = Chime("https://hooks.chime.aws/incomingwebhooks/sample_chime_url?token=123456")
val referenceObject = NotificationConfig(
"this is a sample config name",
"this is a sample config description",
Expand Down Expand Up @@ -157,7 +157,7 @@ class ChimeNotificationConfigCrudIT : PluginRestTestCase() {

fun `test update existing config to different config type`() {
// Create sample config request reference
val sampleChime = Chime("https://domain.com/sample_chime_url#1234567890")
val sampleChime = Chime("https://hooks.chime.aws/incomingwebhooks/sample_chime_url?token=123456")
val referenceObject = NotificationConfig(
"this is a sample config name",
"this is a sample config description",
Expand Down Expand Up @@ -245,7 +245,7 @@ class ChimeNotificationConfigCrudIT : PluginRestTestCase() {

fun `test update Chime webhook URL`() {
// Create sample config request reference
val sampleChime = Chime("https://domain.com/sample_chime_url#1234567890")
val sampleChime = Chime("https://hooks.chime.aws/incomingwebhooks/sample_chime_url?token=123456")
val referenceObject = NotificationConfig(
"this is a sample config name",
"this is a sample config description",
Expand Down Expand Up @@ -278,7 +278,7 @@ class ChimeNotificationConfigCrudIT : PluginRestTestCase() {
"description":"this is a updated config description",
"config_type":"chime",
"is_enabled":"true",
"chime":{"url":"https://updated.domain.com/updated_chime_url#0987654321"}
"chime":{"url":"https://hooks.chime.aws/incomingwebhooks/sample_chime_url?token=654321"}
}
}
""".trimIndent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class CreateNotificationConfigIT : PluginRestTestCase() {
fun `test Create chime notification config with ID`() {
// Create sample config request reference
val configId = "sample_config_id"
val sampleChime = Chime("https://domain.com/sample_chime_url#1234567890")
val sampleChime = Chime("https://hooks.chime.aws/incomingwebhooks/sample_chime_url?token=123456")
val referenceObject = NotificationConfig(
"this is a sample config name",
"this is a sample config description",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ class MicrosoftTeamsNotificationConfigCrudIT : PluginRestTestCase() {
"description":"${referenceObject.description}",
"config_type":"microsoft_teams",
"is_enabled":${referenceObject.isEnabled},
"chime":{"url":"https://dummy.com"},
"chime":{"url":"https://hooks.chime.aws/incomingwebhooks/sample_chime_url?token=123456"},
"microsoft_teams":{"url":"${(referenceObject.configData as MicrosoftTeams).url}"}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ class QueryNotificationConfigIT : PluginRestTestCase() {
val urlIds = setOf(slackId, chimeId, microsoftTeamsId, webhookId)
val recipientIds = setOf(emailGroupId)
val fromIds = setOf(emailGroupId, smtpAccountId)
val domainIds = setOf(chimeId, microsoftTeamsId, webhookId, smtpAccountId)
val domainIds = setOf(microsoftTeamsId, webhookId, smtpAccountId)
Thread.sleep(1000)

// Get notification configs using query=slack
Expand Down Expand Up @@ -702,7 +702,7 @@ class QueryNotificationConfigIT : PluginRestTestCase() {
val urlIds = setOf(slackId, chimeId, microsoftTeamsId, webhookId)
val recipientIds = setOf(emailGroupId)
val fromIds = setOf(emailGroupId, smtpAccountId)
val domainIds = setOf(chimeId, microsoftTeamsId, webhookId, smtpAccountId)
val domainIds = setOf(microsoftTeamsId, webhookId, smtpAccountId)
Thread.sleep(1000)

// Get notification configs using text_query=slack should not return any item
Expand Down Expand Up @@ -780,7 +780,7 @@ class QueryNotificationConfigIT : PluginRestTestCase() {
Thread.sleep(1000)

// Create sample config request reference
val sampleChime = Chime("https://domain.com/sample_chime_url#1234567890")
val sampleChime = Chime("https://hooks.chime.aws/incomingwebhooks/sample_chime_url?token=123456")
val referenceObject = NotificationConfig(
"this is a sample config name",
"this is a sample config description",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class SlackNotificationConfigCrudIT : PluginRestTestCase() {
"description":"${referenceObject.description}",
"config_type":"slack",
"is_enabled":${referenceObject.isEnabled},
"chime":{"url":"https://dummy.com"}
"chime":{"url":"https://hooks.chime.aws/incomingwebhooks/sample_chime_url?token=123456"}
"slack":{"url":"${(referenceObject.configData as Slack).url}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class SnsNotificationConfigCrudIT : PluginRestTestCase() {
"description":"${referenceObject.description}",
"config_type":"sns",
"is_enabled":${referenceObject.isEnabled},
"chime":{"url":"https://dummy.com"}
"chime":{"url":"https://hooks.chime.aws/incomingwebhooks/sample_chime_url?token=123456"}
"sns":{"topic_arn":"${(referenceObject.configData as Sns).topicArn}","role_arn":"${(referenceObject.configData as Sns).roleArn}"}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ internal class SendTestMessageRestHandlerIT : PluginRestTestCase() {
"config_type":"chime",
"is_enabled":true,
"chime":{
"url":"https://hooks.chime.aws/incomingwebhooks/xxxx"
"url":"https://hooks.chime.aws/incomingwebhooks/xxxx?token=xxxx"
}
}
}
Expand Down

0 comments on commit 1a7bcfa

Please sign in to comment.