-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b315dfb
commit 1bb4d4b
Showing
2 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"services": { | ||
"test_service": { | ||
"procedures": { | ||
"rpc_method": { | ||
"input": { | ||
"type": "object", | ||
"properties": { | ||
"data": { | ||
"type": "string" | ||
} | ||
}, | ||
"required": ["data"] | ||
}, | ||
"output": { | ||
"type": "object", | ||
"properties": { | ||
"data": { | ||
"type": "string" | ||
} | ||
}, | ||
"required": ["data"] | ||
}, | ||
"errors": { | ||
"not": {} | ||
}, | ||
"type": "rpc" | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from datetime import timedelta | ||
|
||
import pytest | ||
|
||
from replit_river.client import Client | ||
from replit_river.codegen.client import schema_to_river_client_codegen | ||
from tests.common_handlers import basic_rpc_method | ||
|
||
|
||
@pytest.mark.asyncio | ||
@pytest.mark.parametrize("handlers", [{**basic_rpc_method}]) | ||
async def test_foo(client: Client): | ||
schema_to_river_client_codegen( | ||
"tests/codegen/rpc/schema.json", "tests/codegen/dist/rpc", "RpcClient", True | ||
) | ||
from tests.codegen.dist.rpc import RpcClient | ||
|
||
name = "feep" | ||
_c = RpcClient(client) | ||
res = await _c.test_service.rpc_method({ | ||
"data": name, | ||
}, timedelta(seconds=5)) | ||
assert res.data == "Hello, feep!", f"Expected 'Hello, {name}!' received {res.data}" |