-
Notifications
You must be signed in to change notification settings - Fork 65
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
Add support for multiple test verbs and fix /_render/template. #723
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
$schema: ../../../../json_schemas/test_story.schema.yaml | ||
|
||
description: Test rendering a search template as a search query. | ||
|
||
prologues: | ||
- path: /_scripts/movie_template | ||
method: POST | ||
request: | ||
content_type: application/json | ||
payload: | ||
script: | ||
lang: mustache | ||
source: > | ||
{ | ||
"query": { | ||
"match": { | ||
"{{field}}": "{{value}}" | ||
} | ||
} | ||
} | ||
epilogues: | ||
- path: /_scripts/movie_template | ||
method: DELETE | ||
status: [200, 404] | ||
chapters: | ||
- synopsis: Render the movie template (request payload). | ||
path: /_render/template | ||
method: | ||
- GET | ||
- POST | ||
request: | ||
payload: | ||
id: movie_template | ||
params: | ||
field: director | ||
value: Quentin Tarantino | ||
response: | ||
status: 200 | ||
payload: | ||
template_output: | ||
query: | ||
match: | ||
director: Quentin Tarantino | ||
- synopsis: Render the movie template (path). | ||
path: /_render/template/{id} | ||
method: | ||
- GET | ||
- POST | ||
parameters: | ||
id: movie_template | ||
request: | ||
payload: | ||
params: | ||
field: director | ||
value: Christopher Nolan | ||
response: | ||
status: 200 | ||
payload: | ||
template_output: | ||
query: | ||
match: | ||
director: Christopher Nolan |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great shorthand for writing the same chapter multiple times with different methods. I think we should treat it as such: Multiple chapters that virtually identical but the method. And then when the story is read, we will turn that 1 chapter of
Create index "books"
into two chapter:Create Index "book" [With POST]
Create Index "book" [With PUT]
Then you will only have to modify the story parser to turn that 1 chapter into 2 and the rest of the framework can stay intact. We can add a line in this guide saying that the chapter will be split into 2 so they know what to expect in the Result page.
Arguably, a case like this should be treat as 2 different stories because rarely are our non-PUT requests idempotent (even when you delete a resource on OS twice, you get 404 the second time). So you could not actually test this on
PUT/POST /books
because executingPUT /books
afterPOST /books
will result inindex named books already exists
error. This will open a can of worm of matrix argument when we have multiple of such chapters in an original story.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay let me see if I can do a parser-based implementation instead ...