From 1eb035189e3915e1ba9c84be58e3213584884a62 Mon Sep 17 00:00:00 2001 From: Denis Stepanov Date: Fri, 5 Jun 2015 12:56:58 +0200 Subject: [PATCH] Add more tests --- .../accurest/dsl/WiremockGroovyDslSpec.groovy | 60 ++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/accurest-core/src/test/groovy/io/codearte/accurest/dsl/WiremockGroovyDslSpec.groovy b/accurest-core/src/test/groovy/io/codearte/accurest/dsl/WiremockGroovyDslSpec.groovy index ba6211223d..6e3843e146 100755 --- a/accurest-core/src/test/groovy/io/codearte/accurest/dsl/WiremockGroovyDslSpec.groovy +++ b/accurest-core/src/test/groovy/io/codearte/accurest/dsl/WiremockGroovyDslSpec.groovy @@ -343,7 +343,7 @@ class WiremockGroovyDslSpec extends WiremockSpec { { "request": { "method": "GET", - "urlPath":"users", + "urlPath": "users", "queryParameters": { "offset": { "contains": "10" @@ -377,6 +377,64 @@ class WiremockGroovyDslSpec extends WiremockSpec { stubMappingIsValidWiremockStub(json) } + def "should generate request with urlPath for client side"() { + given: + GroovyDsl groovyDsl = GroovyDsl.make { + request { + method 'GET' + urlPath $(client("boxes"), server("items")) + } + response { + status 200 + } + } + when: + def json = toWiremockClientJsonStub(groovyDsl) + then: + parseJson(json) == parseJson(''' + { + "request": { + "method": "GET", + "urlPath": "boxes" + }, + "response": { + "status": 200, + } + } + ''') + and: + stubMappingIsValidWiremockStub(json) + } + + def "should generate simple request with urlPath for client side"() { + given: + GroovyDsl groovyDsl = GroovyDsl.make { + request { + method 'GET' + urlPath "boxes" + } + response { + status 200 + } + } + when: + def json = toWiremockClientJsonStub(groovyDsl) + then: + parseJson(json) == parseJson(''' + { + "request": { + "method": "GET", + "urlPath": "boxes" + }, + "response": { + "status": 200, + } + } + ''') + and: + stubMappingIsValidWiremockStub(json) + } + def "should generate request with url and queryParameters for client side"() { given: GroovyDsl groovyDsl = GroovyDsl.make {