Skip to content

Commit

Permalink
test(google): Enable the GoogleChatNotificationAgent test (#650)
Browse files Browse the repository at this point in the history
  • Loading branch information
plumpy committed Sep 10, 2019
1 parent 2e50b45 commit ff2268c
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ package com.netflix.spinnaker.echo.notification
import com.netflix.spinnaker.echo.googlechat.GoogleChatMessage
import com.netflix.spinnaker.echo.googlechat.GoogleChatService
import com.netflix.spinnaker.echo.model.Event
import spock.lang.Specification
import spock.lang.Subject
import spock.lang.Unroll
import spock.util.concurrent.BlockingVariable

public class GoogleChatNotificationAgentSpec {
public class GoogleChatNotificationAgentSpec extends Specification {

def googleChat = Mock(GoogleChatService)
@Subject
Expand All @@ -41,7 +42,7 @@ public class GoogleChatNotificationAgentSpec {
agent.sendNotifications([address: webhookURL], application, event, [type: type, link: "link"], status)

then:
actualMessage.get().text ==~ expectedMessage
actualMessage.get().message ==~ expectedMessage

where:
status || expectedMessage
Expand All @@ -67,7 +68,7 @@ public class GoogleChatNotificationAgentSpec {
agent.sendNotifications([address: webhookURL, message: message], application, event, [type: type, link: "link"], status)

then:
actualMessage.get().text ==~ expectedMessage
actualMessage.get().message ==~ expectedMessage

where:
status || expectedMessage
Expand Down Expand Up @@ -96,7 +97,7 @@ public class GoogleChatNotificationAgentSpec {
agent.sendNotifications([address: webhookURL], application, event, [type: type], "etc")

then:
actualMessage.get().text == expectedMessage
actualMessage.get().message == expectedMessage

where:
customMessage || expectedMessage
Expand All @@ -107,9 +108,9 @@ public class GoogleChatNotificationAgentSpec {
webhookURL = "https://chat.googleapis.com/v1/spaces/spooky"
application = "whatever"
event = new Event(content: [
execution: [id: "1", name: "foo-pipeline"],
context: [ customMessage: customMessage ],
name: 'a stage'
execution: [id: "1", name: "foo-pipeline"],
context : [customMessage: customMessage],
name : 'a stage'
])
type = "stage"
}
Expand Down

0 comments on commit ff2268c

Please sign in to comment.