From 0e6767e3c902e726eb6866289d5a47d82d42e175 Mon Sep 17 00:00:00 2001 From: Petr Pchelko Date: Tue, 2 Apr 2019 14:09:49 -0300 Subject: [PATCH] Do not duplicate x-amples tests in endpoints. Bug: T218218 Change-Id: Ide4208bacecfb7683523ea0237a037f0372d4a08 --- test/features/specification/monitoring.js | 11 ++++++- v1/content.yaml | 9 +++--- v1/mobileapps.yaml | 1 + v1/transform.yaml | 39 ++++++++++++----------- 4 files changed, 36 insertions(+), 24 deletions(-) diff --git a/test/features/specification/monitoring.js b/test/features/specification/monitoring.js index 700b925f8..71b6e37f6 100644 --- a/test/features/specification/monitoring.js +++ b/test/features/specification/monitoring.js @@ -51,7 +51,10 @@ function constructTests(spec, options, server) { ret.push(constructTestCase( ex.title, - uri.toString({ params: ex.request.params }), + uri.toString({ + params: ex.request.params, + format: 'simplePattern' + }), method, ex.request, ex.response || {} @@ -180,6 +183,12 @@ describe('Monitoring tests', function() { parallel(`Monitoring routes, ${options.domain} domain`, () => { constructTests(spec, options, server).forEach((testCase) => { it(testCase.title, () => { + const missingParam = /\/{(.+)}/.exec(testCase.request.uri); + if (missingParam) { + throw new assert.AssertionError({ + message: `Incorrect test spec, missing '${missingParam[1]}'` + }); + } return preq(testCase.request) .then((res) => { validateTestResponse(testCase, res); diff --git a/v1/content.yaml b/v1/content.yaml index bc5d8893e..112bc9c1d 100644 --- a/v1/content.yaml +++ b/v1/content.yaml @@ -126,6 +126,7 @@ paths: description: The revision id type: integer required: true + x-monitor: false /html/{title}: x-route-filters: @@ -537,9 +538,9 @@ paths: x-monitor: false /html/{title}/{revision}/{tid}: - x-route-filters: + x-route-filters: <<: *html_title_revision_filters - get: + get: <<: *html_title_revision_get_spec operationId: getFormatRevision2 parameters: @@ -748,9 +749,9 @@ paths: x-monitor: false /lint/{title}/{revision}: - x-route-filters: + x-route-filters: <<: *lint_title_filters - get: + get: <<: *lint_title_get_spec parameters: - name: title diff --git a/v1/mobileapps.yaml b/v1/mobileapps.yaml index 6e18d3531..dd3131095 100644 --- a/v1/mobileapps.yaml +++ b/v1/mobileapps.yaml @@ -142,6 +142,7 @@ paths: Example: `sr-el` for Latin transcription of the Serbian language. required: false type: string + x-monitor: false /mobile-sections-lead/{title}: x-route-filters: &mobile-sections-lead_title_filters diff --git a/v1/transform.yaml b/v1/transform.yaml index 39f4d312a..0a24c0fe2 100644 --- a/v1/transform.yaml +++ b/v1/transform.yaml @@ -102,7 +102,7 @@ paths: x-monitor: false /html/to/wikitext/{title}: - post: + post: <<: *html_to_wikitext_post_spec parameters: - name: title @@ -161,7 +161,7 @@ paths: Required if both `title` and `revision` parameters are present. type: string required: false - + /wikitext/to/html: post: &wikitext_to_html_post_spec tags: @@ -237,21 +237,7 @@ paths: wikitext: '{{wikitext}}' body_only: '{{body_only}}' stash: '{{stash}}' - x-monitor: true - x-amples: - - title: Transform wikitext to html - request: - params: - domain: en.wikipedia.org - title: User:BSitzmann_(WMF)/MCS/Test/Frankenstein - body: - wikitext: == Heading == - body_only: true - response: - status: 200 - headers: - content-type: /^text\/html.+/ - body: /^Heading<\/h2>$/ + x-monitor: false /wikitext/to/html/{title}: post: @@ -278,6 +264,21 @@ paths: description: Whether to temporarily stash the result of the transformation type: boolean required: false + x-monitor: true + x-amples: + - title: Transform wikitext to html + request: + params: + domain: en.wikipedia.org + title: User:BSitzmann_(WMF)/MCS/Test/Frankenstein + body: + wikitext: == Heading == + body_only: true + response: + status: 200 + headers: + content-type: /^text\/html.+/ + body: /^Heading<\/h2>$/ /wikitext/to/html/{title}/{revision}: post: @@ -309,7 +310,7 @@ paths: description: Whether to temporarily stash the result of the transformation type: boolean required: false - + /wikitext/to/lint: post: &wikitext_to_lint_post_spec tags: @@ -407,7 +408,7 @@ paths: type: string required: true x-textarea: true - + # Keeping this in, as we'll re-introduce a html2html end point later. # /html/to/html{/title}{/revision}: # post: