Skip to content

Commit 97d064d

Browse files
author
Joel Collins
committed
Tests for basic tagging
1 parent 59a1d8b commit 97d064d

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/test_server_decorators.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@
1010
from labthings.server import decorators
1111

1212

13+
@pytest.fixture
14+
def empty_cls():
15+
class Index:
16+
pass
17+
18+
return Index
19+
20+
1321
def common_task_test(marshaled_task: dict):
1422
assert isinstance(marshaled_task, dict)
1523
assert isinstance(marshaled_task.get("id"), str)
@@ -110,3 +118,19 @@ def func():
110118

111119
with app_ctx.test_request_context(), pytest.raises(TypeError):
112120
wrapped_func()
121+
122+
123+
def test_thing_action(empty_cls):
124+
wrapped_cls = decorators.thing_action(empty_cls)
125+
assert wrapped_cls.__apispec__["tags"] == ["actions"]
126+
assert wrapped_cls.__apispec__["_groups"] == ["actions"]
127+
128+
129+
def test_safe(empty_cls):
130+
wrapped_cls = decorators.safe(empty_cls)
131+
assert wrapped_cls.__apispec__["_safe"] == True
132+
133+
134+
def test_idempotent(empty_cls):
135+
wrapped_cls = decorators.idempotent(empty_cls)
136+
assert wrapped_cls.__apispec__["_idempotent"] == True

0 commit comments

Comments
 (0)