module GdsApi::TestHelpers::PublishingApi
def publishing_api_has_path_reservation_for(path, publishing_app)
def publishing_api_has_path_reservation_for(path, publishing_app) data = publishing_api_path_data_for(path, "publishing_app" => publishing_app) error_data = data.merge("errors" => { "path" => ["is already reserved by the #{publishing_app} application"] }) stub_request(:put, "#{PUBLISHING_API_ENDPOINT}/paths#{path}"). to_return(status: 422, body: error_data.to_json, headers: { content_type: "application/json" }) stub_request(:put, "#{PUBLISHING_API_ENDPOINT}/paths#{path}"). with(body: { "publishing_app" => publishing_app }). to_return(status: 200, headers: { content_type: "application/json" }, body: data.to_json) end