Add function to assert right request param.
Signed-off-by: Yahor Berdnikau <egorr.berd@gmail.com>
This commit is contained in:
parent
1d35d0c23c
commit
9bf0176984
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue