| @openapi-file=src/main/resources/public/apis/openapi.yml | |
| Feature: CustomerApi | |
| Background: | |
| * url baseUrl | |
| # * def auth = { username: '', password: '' } | |
| * def authHeader = call read('classpath:karate-auth.js') auth | |
| * configure headers = authHeader || {} | |
| @operationId=createCustomer | |
| Scenario: createCustomer | |
| Given path '/customers' | |
| And request | |
| """ | |
| { | |
| "id" : 27, | |
| "version" : 39, | |
| "name" : "name-igg5xpg15axb20ssv6h", | |
| "email" : "dewey.dibbert@gmail.com", | |
| "addresses" : [ { | |
| "street" : "street-o3z", | |
| "city" : "North Stepanie" | |
| } ], | |
| "paymentMethods" : [ { | |
| "id" : 35, | |
| "version" : 81, | |
| "type" : "VISA", | |
| "cardNumber" : "cardNumber-f2twmzjgr6f6ufp" | |
| } ] | |
| } | |
| """ | |
| When method post | |
| Then status 201 | |
| * def createCustomerResponse = response | |
| * def customerId = response.id | |
| @operationId=getCustomer | |
| Scenario: getCustomer | |
| * def pathParams = { id: 50 } | |
| Given path '/customers/', pathParams.id | |
| When method get | |
| Then status 200 | |
| * def getCustomerResponse = response | |
| * def customerId = response.id | |
| @operationId=updateCustomer | |
| Scenario: updateCustomer | |
| * def pathParams = { id: 85 } | |
| Given path '/customers/', pathParams.id | |
| And request | |
| """ | |
| { | |
| "id" : 81, | |
| "version" : 97, | |
| "name" : "name-505qcgrn06met1b", | |
| "email" : "alycia.goodwin@hotmail.com", | |
| "addresses" : [ { | |
| "street" : "street-thtje5itfiytnmo9qrq", | |
| "city" : "Mauriciostad" | |
| } ], | |
| "paymentMethods" : [ { | |
| "id" : 26, | |
| "version" : 11, | |
| "type" : "MASTERCARD", | |
| "cardNumber" : "cardNumber-4v31g76wuz" | |
| } ] | |
| } | |
| """ | |
| When method put | |
| Then status 200 | |
| * def updateCustomerResponse = response | |
| * def customerId = response.id | |
| @operationId=deleteCustomer | |
| Scenario: deleteCustomer | |
| * def pathParams = { id: 47 } | |
| Given path '/customers/', pathParams.id | |
| When method delete | |
| Then status 204 | |
| * def deleteCustomerResponse = response | |
| @operationId=searchCustomers | |
| Scenario: searchCustomers | |
| Given path '/customers/search' | |
| And def queryParams = page: 41, limit: 25, sort: [null-by2aunzpbul86hoemqjsf] | |
| And request | |
| """ | |
| { | |
| "name" : "name-lbxnuiozv7o0", | |
| "email" : "leo.abbott@gmail.com", | |
| "city" : "West Leonardberg", | |
| "state" : "state-36s" | |
| } | |
| """ | |
| When method post | |
| Then status 201 | |
| * def searchCustomersResponse = response | |
| * def customerPaginatedId = response.id | |