File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 1010from labthings .server import decorators
1111
1212
13+ @pytest .fixture
14+ def empty_cls ():
15+ class Index :
16+ pass
17+
18+ return Index
19+
20+
1321def 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
You can’t perform that action at this time.
0 commit comments