Skip to content

Commit 3b4c58c

Browse files
committed
test: add test for retrieving public protocols
1 parent ba30138 commit 3b4c58c

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

tests/test_protocols_io_api.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,30 @@ async def test_get_profile():
1111
assert "user" in profile
1212
assert "name" in profile["user"]
1313
assert "username" in profile["user"]
14-
assert "affiliation" in profile["user"]
14+
assert "affiliation" in profile["user"]
15+
16+
@pytest.mark.asyncio
17+
async def test_get_public_protocols():
18+
"""
19+
Test the get public protocols feature of the protocols.io API.
20+
"""
21+
response = await helpers.access_protocols_io_resource("GET", "/v3/protocols?filter=public&key=dna&page_size=3")
22+
assert isinstance(response, dict)
23+
assert "items" in response
24+
protocols = response["items"]
25+
assert isinstance(protocols, list)
26+
assert len(protocols) > 0
27+
for protocol in protocols:
28+
assert isinstance(protocol, dict)
29+
assert "id" in protocol
30+
assert "title" in protocol
31+
assert "description" in protocol
32+
assert "guidelines" in protocol
33+
assert "before_start" in protocol
34+
assert "warning" in protocol
35+
assert "materials_text" in protocol
36+
assert "doi" in protocol
37+
assert "public" in protocol
38+
assert "url" in protocol
39+
assert "created_on" in protocol
40+
assert "published_on" in protocol

0 commit comments

Comments
 (0)