From 9bf0176984742f03b86840a6adcc6916766249de Mon Sep 17 00:00:00 2001 From: Yahor Berdnikau Date: Fri, 25 Aug 2017 21:31:57 +0200 Subject: [PATCH] Add function to assert right request param. Signed-off-by: Yahor Berdnikau --- .../moire/ultrasonic/api/subsonic/CommonFunctions.kt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/CommonFunctions.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/CommonFunctions.kt index e57b53e1..817c0ada 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/CommonFunctions.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/CommonFunctions.kt @@ -3,6 +3,7 @@ package org.moire.ultrasonic.api.subsonic import okhttp3.mockwebserver.MockResponse import okio.Okio import org.amshove.kluent.`should be` +import org.amshove.kluent.`should contain` import org.amshove.kluent.`should not be` import org.moire.ultrasonic.api.subsonic.response.SubsonicResponse import org.moire.ultrasonic.api.subsonic.rules.MockWebServerRule @@ -63,3 +64,14 @@ fun SubsonicResponse.assertBaseResponseOk() { version `should be` SubsonicAPIVersions.V1_13_0 error `should be` null } + +fun MockWebServerRule.assertRequestParam(responseResourceName: String, + apiRequest: () -> Response, + expectedParam: String) { + this.enqueueResponse(responseResourceName) + apiRequest() + + val request = this.mockWebServer.takeRequest() + + request.requestLine `should contain` expectedParam +}