Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not duplicate x-amples tests in endpoints. #1105

Merged
merged 1 commit into from
Apr 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion test/features/specification/monitoring.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 || {}
Expand Down Expand Up @@ -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);
Expand Down
9 changes: 5 additions & 4 deletions v1/content.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ paths:
description: The revision id
type: integer
required: true
x-monitor: false

/html/{title}:
x-route-filters:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions v1/mobileapps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
39 changes: 20 additions & 19 deletions v1/transform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ paths:
x-monitor: false

/html/to/wikitext/{title}:
post:
post:
<<: *html_to_wikitext_post_spec
parameters:
- name: title
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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: /^<h2.*>Heading<\/h2>$/
x-monitor: false

/wikitext/to/html/{title}:
post:
Expand All @@ -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: /^<h2.*>Heading<\/h2>$/

/wikitext/to/html/{title}/{revision}:
post:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down