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

Add an example that uses vars key #27

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
14 changes: 11 additions & 3 deletions demo-api/snippets.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
name: snippets
path: snippets/
vars:
greeting: hello ${USER}
headers:
Authorization: Token ${token}
requests:
- name: create
method: post
body:
title: Hello World
code: "print('hello world')"
code: "print('${greeting}')"
style: "xcode"
language: "python"
vars:
snippet_id: ${{response.json()["id"]}}
my_var_1: my_var_1_value
my_var_2: ${{ 'my_var_2_value' }}
tests:
- !include tests/status_code_is_201.yaml
- !include tests/response_time_2_seconds.yaml
Expand All @@ -25,6 +29,10 @@ requests:
- !include tests/language_in_content.yaml
- !include tests/style_in_content.yaml
- name: details
vars:
my_var_3: ${my_var_1}
my_var_4: ${my_var_2}

path: ${snippet_id}/
tests:
- !include tests/status_code_is_200.yaml
Expand All @@ -40,7 +48,7 @@ requests:
- !include tests/style_in_content.yaml

- name: update_with_patch
path: ${snippet_id}/
path: ${snippet_id}/?${my_var_3}&${my_var_4}
method: patch
body:
code: "print('hello, patch')"
Expand All @@ -61,7 +69,7 @@ requests:
method: put
body:
title: Hello World - Ruby
code: "puts 'hello world'"
code: "puts '${greeting}'"
style: "emacs"
language: "ruby"
tests:
Expand Down