Skip to content

Commit da0eb60

Browse files
committed
RTU: unskip test
1 parent cebb622 commit da0eb60

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

tests/nexus/test_handler.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ class NonSerializableOutput:
8989
class MyService:
9090
echo: nexusrpc.Operation[Input, Output]
9191
# TODO(nexus-prerelease): support renamed operations!
92-
# echo_renamed: nexusrpc.Operation[Input, Output] = (
93-
# nexusrpc.Operation(name="echo-renamed")
94-
# )
92+
echo_renamed: nexusrpc.Operation[Input, Output] = nexusrpc.Operation(
93+
name="echo-renamed"
94+
)
9595
hang: nexusrpc.Operation[Input, Output]
9696
log: nexusrpc.Operation[Input, Output]
9797
workflow_run_operation_happy_path: nexusrpc.Operation[Input, Output]
@@ -147,6 +147,17 @@ async def echo(self, ctx: StartOperationContext, input: Input) -> Output:
147147
value=f"from start method on {self.__class__.__name__}: {input.value}"
148148
)
149149

150+
# The name override is prsent in the service definition. But the test below submits
151+
# the same operation name in the request whether using a service definition or now.
152+
# The name override here is necessary when the test is not using the service
153+
# definition. It should be permitted when the service definition is in effect, as
154+
# long as the name override is the same as that in the service definition.
155+
# TODO(nexus-prerelease): implement in nexusrpc the check that operation handler
156+
# name overrides must be consistent with service definition overrides.
157+
@sync_operation(name="echo-renamed")
158+
async def echo_renamed(self, ctx: StartOperationContext, input: Input) -> Output:
159+
return await self.echo(ctx, input)
160+
150161
@sync_operation
151162
async def hang(self, ctx: StartOperationContext, input: Input) -> Output:
152163
await asyncio.Future()
@@ -467,13 +478,8 @@ class SyncHandlerHappyPath(_TestCase):
467478
), "Nexus-Link header not echoed correctly."
468479

469480

470-
class SyncHandlerHappyPathRenamed(_TestCase):
481+
class SyncHandlerHappyPathRenamed(SyncHandlerHappyPath):
471482
operation = "echo-renamed"
472-
input = Input("hello")
473-
expected = SuccessfulResponse(
474-
status_code=200,
475-
body_json={"value": "from start method on MyServiceHandler: hello"},
476-
)
477483

478484

479485
class SyncHandlerHappyPathNonAsyncDef(_TestCase):
@@ -707,8 +713,7 @@ class NonSerializableOutputFailure(_FailureTestCase):
707713
"test_case",
708714
[
709715
SyncHandlerHappyPath,
710-
# TODO(nexus-prerelease): support renamed operations!
711-
# SyncHandlerHappyPathRenamed,
716+
SyncHandlerHappyPathRenamed,
712717
SyncHandlerHappyPathNonAsyncDef,
713718
# TODO(nexus-prerelease): make callable instance work
714719
# SyncHandlerHappyPathWithNonAsyncCallableInstance,

0 commit comments

Comments
 (0)