spec/support/fake_api.rb in finapps-2.1.2 vs spec/support/fake_api.rb in finapps-2.1.3

- old
+ new

@@ -11,11 +11,11 @@ delete('/v2/resources/:id') { status 202 } # orders post('/v2/orders/valid_token') { json_response 200, 'order_token.json' } post('/v2/orders/invalid_token') { json_response 404, 'resource_not_found.json' } - get('/v2/orders/:id') { json_response 200, 'resource.json' } + get('/v2/orders/valid_id') { json_response 200, 'resource.json' } get('/v2/list/orders/:page/:requested/:sort/:asc') { json_response 200, 'orders.json' } get('/v2/orders/valid_id/report.:format') { json_response 200, 'order_report.json' } get('/v2/orders/invalid_id/report.:format') { json_response 404, 'resource_not_found.json' } get('/v2/orders/valid_id/status') { json_response 200, 'order_status.json' } get('/v2/orders/invalid_id/status') { json_response 404, 'resource_not_found.json' } @@ -81,16 +81,33 @@ else json_response(401, 'unauthorized.json') end end + # password resets + post('/v2/tenant/valid_user_id/password') { json_response 200, 'password_reset_token.json' } + post('/v2/tenant/invalid_user_id/password') { json_response 404, 'resource_not_found.json' } + put('/v2/tenant/valid_user_id/password') do + request.body.rewind + request_payload = JSON.parse request.body.read + if request_payload['token'] == 'valid_token' + json_response(200, 'user.json') + else + json_response(400, 'invalid_request_body.json') + end + end + put('/v2/tenant/invalid_user_id/password') { json_response 404, 'resource_not_found.json' } + # relevance get('/v2/relevance/ruleset/names') { json_response 200, 'relevance_ruleset_names.json' } # errors get('/v2/client_error') { json_response 400, 'error.json' } get('/v2/server_error') { status 500 } get('/v2/proxy_error') { status 407 } + + # timeout + get('/v2/orders/timeout') { status 419 } private def json_response(response_code, file_name) content_type :json