Created
July 18, 2020 10:17
-
-
Save iainporter/84446dd70a80ae06f6ddbbb9456916f7 to your computer and use it in GitHub Desktop.
Component test to send a message
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SendMessageTest : TestEnvironment() { | |
@Test | |
fun `a valid request to send a SMS Message`() { | |
//send a message | |
val request = """{"text":"Foo Bar", "fromNumber":"+1234567890", "toNumber":"+1234567899"}""" | |
val response = RestFunctions.sendSmsMessage(request) | |
val location = response.header("Location") | |
//check the message can be retrieved | |
val messageResponse = RestFunctions.getMessage(location) | |
val json = messageResponse.body.jsonPath() | |
assertThat(json.get("id"), `is`(location.substring(location.lastIndexOf("/")+ 1))) | |
assertThat(json.get("status"), `is`("WAITING")) | |
assertThat(json.get("toNumber"), `is`("+1234567899")) | |
assertThat(json.get("fromNumber"), `is`("+1234567890")) | |
assertThat(json.get("text"), `is`("Foo Bar")) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment