Skip to content

Commit d0b7e2b

Browse files
committed
Add an example that uses vars key
1 parent e6c251e commit d0b7e2b

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

Diff for: demo-api/snippets.yaml

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
name: snippets
22
path: snippets/
3+
vars:
4+
greeting: hello ${USER}
35
headers:
46
Authorization: Token ${token}
57
requests:
68
- name: create
79
method: post
810
body:
911
title: Hello World
10-
code: "print('hello world')"
12+
code: "print('${greeting}')"
1113
style: "xcode"
1214
language: "python"
1315
vars:
1416
snippet_id: ${{response.json()["id"]}}
17+
my_var_1: my_var_1_value
18+
my_var_2: ${{ 'my_var_2_value' }}
1519
tests:
1620
- !include tests/status_code_is_201.yaml
1721
- !include tests/response_time_2_seconds.yaml
@@ -25,6 +29,10 @@ requests:
2529
- !include tests/language_in_content.yaml
2630
- !include tests/style_in_content.yaml
2731
- name: details
32+
vars:
33+
my_var_3: ${my_var_1}
34+
my_var_4: ${my_var_2}
35+
2836
path: ${snippet_id}/
2937
tests:
3038
- !include tests/status_code_is_200.yaml
@@ -40,7 +48,7 @@ requests:
4048
- !include tests/style_in_content.yaml
4149

4250
- name: update_with_patch
43-
path: ${snippet_id}/
51+
path: ${snippet_id}/?${my_var_3}&${my_var_4}
4452
method: patch
4553
body:
4654
code: "print('hello, patch')"
@@ -61,7 +69,7 @@ requests:
6169
method: put
6270
body:
6371
title: Hello World - Ruby
64-
code: "puts 'hello world'"
72+
code: "puts '${greeting}'"
6573
style: "emacs"
6674
language: "ruby"
6775
tests:

0 commit comments

Comments
 (0)