Skip to content

Commit ecc7f30

Browse files
committed
separate auth/anon tests
1 parent 55f5f26 commit ecc7f30

File tree

2 files changed

+84
-16
lines changed

2 files changed

+84
-16
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
test_name: anonymous retrieval of contributions
2+
3+
stages:
4+
- name: get a contribution from a private project with all fields
5+
skip: True
6+
request:
7+
url: "{tavern.env_vars.MP_CONTRIBS_API_URL}/contributions/"
8+
method: GET
9+
headers:
10+
accept: application/json
11+
params:
12+
project: periodic_band_structures
13+
per_page: 1
14+
_limit: 1
15+
_fields: _all
16+
response:
17+
status_code: 200
18+
json:
19+
data: []
20+
has_more: false
21+
total_count: 0
22+
total_pages: 0
23+
24+
- name: get a contribution with all fields
25+
skip: True
26+
request:
27+
url: "{tavern.env_vars.MP_CONTRIBS_API_URL}/contributions/"
28+
method: GET
29+
headers:
30+
accept: application/json
31+
params:
32+
per_page: 1
33+
_limit: 1
34+
_fields: _all
35+
response:
36+
strict: false
37+
status_code: 200
38+
save:
39+
json:
40+
contrib_anon: "data[0]"
41+
42+
- name: retrieve single contribution with default fields
43+
skip: True
44+
request:
45+
url: "{tavern.env_vars.MP_CONTRIBS_API_URL}/contributions/{contrib_anon.id:s}/"
46+
method: GET
47+
headers:
48+
accept: application/json
49+
response:
50+
status_code: 200
51+
json:
52+
id: "{contrib_anon.id}"
53+
project: "{contrib_anon.project}"
54+
identifier: "{contrib_anon.identifier}"
55+
formula: "{contrib_anon.formula}"
56+
is_public: !bool "{contrib_anon.is_public}"
57+
last_modified: "{contrib_anon.last_modified}"
58+
needs_build: !bool "{contrib_anon.needs_build}"
59+
60+
- name: retrieve single contribution with all fields
61+
skip: True
62+
request:
63+
url: "{tavern.env_vars.MP_CONTRIBS_API_URL}/contributions/{contrib_anon.id:s}/"
64+
params:
65+
_fields: _all
66+
method: GET
67+
headers:
68+
accept: application/json
69+
response:
70+
status_code: 200
71+
json: !force_original_structure "{contrib_anon}"
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
test_name: retrieving contributions
2-
3-
# TODO test public response without API key
4-
# TODO test public vs private projects
1+
test_name: authenticated retrieval of contributions
52

63
stages:
7-
- name: get a random contribution with all fields
4+
- name: get a contribution with all fields
85
request:
96
url: "{tavern.env_vars.MP_CONTRIBS_API_URL}/contributions/"
107
method: GET
@@ -20,29 +17,29 @@ stages:
2017
status_code: 200
2118
save:
2219
json:
23-
contrib: "data[0]"
20+
contrib_auth: "data[0]"
2421

2522
- name: retrieve single contribution with default fields
2623
request:
27-
url: "{tavern.env_vars.MP_CONTRIBS_API_URL}/contributions/{contrib.id:s}/"
24+
url: "{tavern.env_vars.MP_CONTRIBS_API_URL}/contributions/{contrib_auth.id:s}/"
2825
method: GET
2926
headers:
3027
accept: application/json
3128
X-API-KEY: "{tavern.env_vars.MP_API_KEY}"
3229
response:
3330
status_code: 200
3431
json:
35-
id: "{contrib.id}"
36-
project: "{contrib.project}"
37-
identifier: "{contrib.identifier}"
38-
formula: "{contrib.formula}"
39-
is_public: !bool "{contrib.is_public}"
40-
last_modified: "{contrib.last_modified}"
41-
needs_build: !bool "{contrib.needs_build}"
32+
id: "{contrib_auth.id}"
33+
project: "{contrib_auth.project}"
34+
identifier: "{contrib_auth.identifier}"
35+
formula: "{contrib_auth.formula}"
36+
is_public: !bool "{contrib_auth.is_public}"
37+
last_modified: "{contrib_auth.last_modified}"
38+
needs_build: !bool "{contrib_auth.needs_build}"
4239

4340
- name: retrieve single contribution with all fields
4441
request:
45-
url: "{tavern.env_vars.MP_CONTRIBS_API_URL}/contributions/{contrib.id:s}/"
42+
url: "{tavern.env_vars.MP_CONTRIBS_API_URL}/contributions/{contrib_auth.id:s}/"
4643
params:
4744
_fields: _all
4845
method: GET
@@ -51,4 +48,4 @@ stages:
5148
X-API-KEY: "{tavern.env_vars.MP_API_KEY}"
5249
response:
5350
status_code: 200
54-
json: !force_original_structure "{contrib}"
51+
json: !force_original_structure "{contrib_auth}"

0 commit comments

Comments
 (0)