tigrbl-tests 0.3.3.dev2__py3-none-any.whl → 0.3.4.dev2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tests/unit/test_jsonrpc_openrpc.py +48 -0
- {tigrbl_tests-0.3.3.dev2.dist-info → tigrbl_tests-0.3.4.dev2.dist-info}/METADATA +1 -1
- {tigrbl_tests-0.3.3.dev2.dist-info → tigrbl_tests-0.3.4.dev2.dist-info}/RECORD +5 -4
- {tigrbl_tests-0.3.3.dev2.dist-info → tigrbl_tests-0.3.4.dev2.dist-info}/WHEEL +1 -1
- {tigrbl_tests-0.3.3.dev2.dist-info → tigrbl_tests-0.3.4.dev2.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
from fastapi.testclient import TestClient
|
|
2
|
+
from sqlalchemy import Column, String
|
|
3
|
+
from tigrbl import Base, TigrblApp
|
|
4
|
+
from tigrbl.engine.shortcuts import mem
|
|
5
|
+
from tigrbl.orm.mixins import GUIDPk
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def _build_app():
|
|
9
|
+
class Widget(Base, GUIDPk):
|
|
10
|
+
__tablename__ = "widgets_openrpc"
|
|
11
|
+
name = Column(String, nullable=False)
|
|
12
|
+
|
|
13
|
+
app = TigrblApp(engine=mem(async_=False))
|
|
14
|
+
app.include_model(Widget)
|
|
15
|
+
app.initialize()
|
|
16
|
+
app.mount_jsonrpc()
|
|
17
|
+
return app, Widget
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def test_openrpc_endpoint_exposed():
|
|
21
|
+
app, _ = _build_app()
|
|
22
|
+
client = TestClient(app)
|
|
23
|
+
|
|
24
|
+
response = client.get("/rpc/openrpc.json")
|
|
25
|
+
|
|
26
|
+
assert response.status_code == 200
|
|
27
|
+
payload = response.json()
|
|
28
|
+
assert payload["openrpc"] == "1.2.6"
|
|
29
|
+
assert "methods" in payload
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def test_openrpc_includes_method_schema():
|
|
33
|
+
app, model = _build_app()
|
|
34
|
+
client = TestClient(app)
|
|
35
|
+
|
|
36
|
+
payload = client.get("/rpc/openrpc.json").json()
|
|
37
|
+
methods = {method["name"]: method for method in payload["methods"]}
|
|
38
|
+
|
|
39
|
+
create_method = methods[f"{model.__name__}.create"]
|
|
40
|
+
assert create_method["paramStructure"] == "by-name"
|
|
41
|
+
|
|
42
|
+
params = create_method["params"][0]["schema"]
|
|
43
|
+
assert params["title"].startswith(model.__name__)
|
|
44
|
+
assert "Create" in params["title"]
|
|
45
|
+
|
|
46
|
+
result = create_method["result"]["schema"]
|
|
47
|
+
assert result["title"].startswith(model.__name__)
|
|
48
|
+
assert "Response" in result["title"]
|
|
@@ -127,6 +127,7 @@ tests/unit/test_io_spec_attributes.py,sha256=Da9u7yjw-KVbHF1tpQhUvl7HSfooe9L1k5y
|
|
|
127
127
|
tests/unit/test_iospec_attributes.py,sha256=Xl5jOHBVJH4gmZqznaVrO3trqnwWYtztwRIryAnKsJo,2254
|
|
128
128
|
tests/unit/test_iospec_effects.py,sha256=frPnZNX3_dVqmG_b4rUCrrJRzGQ6JzHKCZm0GsM-csA,5687
|
|
129
129
|
tests/unit/test_jsonrpc_id_example.py,sha256=PYn6uNQEbthPpS5iKKbcNKgcgK1vu-vEPQkSU2DxdRE,338
|
|
130
|
+
tests/unit/test_jsonrpc_openrpc.py,sha256=kURb4JOb8saQJme-Gpp4L4Fgw7J3V_1WJXsFk3Mfn4Q,1392
|
|
130
131
|
tests/unit/test_jsonrpc_router_default_tag.py,sha256=AvL54oUgvuxcR_ffzZ7C-XsgkNvID68A5NHNJNSGXRc,255
|
|
131
132
|
tests/unit/test_kernel_invoke_ctx.py,sha256=w89L-XZzpNsh4A2exxbyBx6x96dLvz7ixqzxXCpNUOs,287
|
|
132
133
|
tests/unit/test_kernel_opview_on_demand.py,sha256=WQeZSzkiV8hR3_RP8OJwQTqu96nFoDz9yZOyGTkS4qU,1170
|
|
@@ -211,7 +212,7 @@ tests/unit/test_v3_op_ctx_attributes.py,sha256=ygRtYSYYtDFCTIRVHX2DFYTliP15NcmVi
|
|
|
211
212
|
tests/unit/test_v3_schemas_and_decorators.py,sha256=1wmg7pmzQNjjbQPRjO8gkCM6BQpMRbeO2jmtDMSYXLU,3818
|
|
212
213
|
tests/unit/test_v3_storage_spec_attributes.py,sha256=iXpjD4GlLddhJ_jC2veND2s6usXdOm-S9sKKfQl9XK0,6540
|
|
213
214
|
tests/unit/test_verbosity.py,sha256=92dIDc-LBIzjR1d90aL077R29rYJztibKYQGTjI6G68,1945
|
|
214
|
-
tigrbl_tests-0.3.
|
|
215
|
-
tigrbl_tests-0.3.
|
|
216
|
-
tigrbl_tests-0.3.
|
|
217
|
-
tigrbl_tests-0.3.
|
|
215
|
+
tigrbl_tests-0.3.4.dev2.dist-info/METADATA,sha256=wg0G-PjaTa7XTY_F95lhxzWKemx3YG9ICoQN9PZ85TA,3892
|
|
216
|
+
tigrbl_tests-0.3.4.dev2.dist-info/WHEEL,sha256=kJCRJT_g0adfAJzTx2GUMmS80rTJIVHRCfG0DQgLq3o,88
|
|
217
|
+
tigrbl_tests-0.3.4.dev2.dist-info/licenses/LICENSE,sha256=djUXOlCxLVszShEpZXshZ7v33G-2qIC_j9KXpWKZSzQ,11359
|
|
218
|
+
tigrbl_tests-0.3.4.dev2.dist-info/RECORD,,
|
|
File without changes
|