Skip to content

Commit

Permalink
Add an example that uses vars key
Browse files Browse the repository at this point in the history
  • Loading branch information
hebertjulio committed Aug 16, 2021
1 parent a4dc84e commit ed38f59
Showing 1 changed file with 11 additions and 3 deletions.
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.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

0 comments on commit ed38f59

Please sign in to comment.