Skip to content

Commit

Permalink
test: Video exception responses
Browse files Browse the repository at this point in the history
  • Loading branch information
SMadani committed Aug 30, 2024
1 parent 22ec333 commit 44175f3
Show file tree
Hide file tree
Showing 3 changed files with 264 additions and 109 deletions.
2 changes: 1 addition & 1 deletion src/main/kotlin/com/vonage/client/kt/Video.kt
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class Video(private val client: VideoClient) {

fun sendDtmf(digits: String): Unit = client.sendDtmf(id, digits)

fun startCaptions(token: String, properties: CaptionsRequest.Builder.() -> Unit): UUID =
fun startCaptions(token: String, properties: CaptionsRequest.Builder.() -> Unit = {}): UUID =
client.startCaptions(CaptionsRequest.builder()
.apply(properties).sessionId(id).token(token).build()
).captionsId
Expand Down
9 changes: 9 additions & 0 deletions src/test/kotlin/com/vonage/client/kt/AbstractTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ abstract class AbstractTest {

assert401ApiResponseException<E>(url, requestMethod, actualCall)
assert402ApiResponseException<E>(url, requestMethod, actualCall)
assert403ApiResponseException<E>(url, requestMethod, actualCall)
assert429ApiResponseException<E>(url, requestMethod, actualCall)
}

Expand Down Expand Up @@ -341,6 +342,14 @@ abstract class AbstractTest {
"bf0ca0bf927b3b52e3cb03217e1a1ddf"
)

protected inline fun <reified E: VonageApiResponseException> assert403ApiResponseException(
url: String, requestMethod: HttpMethod, actualCall: () -> Any): E =
assertApiResponseException(url, requestMethod, actualCall, 403,
title = "Forbidden",
code = "10001",
detail = "Invalid token format or signature."
)

protected inline fun <reified E: VonageApiResponseException> assert429ApiResponseException(
url: String, requestMethod: HttpMethod, actualCall: () -> Any): E =
assertApiResponseException(url, requestMethod, actualCall, 429,
Expand Down
Loading

0 comments on commit 44175f3

Please sign in to comment.