Add function to assert right request param.

Signed-off-by: Yahor Berdnikau <egorr.berd@gmail.com>
This commit is contained in:
Yahor Berdnikau 2017-08-25 21:31:57 +02:00
parent 1d35d0c23c
commit 9bf0176984
1 changed files with 12 additions and 0 deletions

View File

@ -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<out SubsonicResponse>,
expectedParam: String) {
this.enqueueResponse(responseResourceName)
apiRequest()
val request = this.mockWebServer.takeRequest()
request.requestLine `should contain` expectedParam
}