Skip to content

Commit f25c667

Browse files
#68 Service input messages are not imported
1 parent 2f9497e commit f25c667

File tree

5 files changed

+47
-1
lines changed

5 files changed

+47
-1
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
syntax = "proto3";
2+
3+
import "request_message.proto";
4+
5+
// Tests generated service correctly imports the RequestMessage
6+
7+
service Test {
8+
rpc DoThing (RequestMessage) returns (RequestResponse);
9+
}
10+
11+
12+
message RequestResponse {
13+
int32 value = 1;
14+
}
15+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
syntax = "proto3";
2+
3+
message RequestArgument {
4+
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
syntax = "proto3";
2+
3+
message RequestMessage {
4+
int32 argument = 1;
5+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import pytest
2+
3+
from betterproto.tests.mocks import MockChannel
4+
from betterproto.tests.output_betterproto.import_service_input_message.import_service_input_message import (
5+
RequestResponse,
6+
TestStub,
7+
)
8+
9+
10+
@pytest.mark.xfail(reason="Request Input Messages are not imported for service")
11+
@pytest.mark.asyncio
12+
async def test_service_correctly_imports_reference_message():
13+
mock_response = RequestResponse(value=10)
14+
service = TestStub(MockChannel([mock_response]))
15+
response = await service.do_thing()
16+
assert mock_response == response

betterproto/tests/test_inputs.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,12 @@ def apply_xfail_marks(test_set: Set[str], xfail: Set[str]):
4646
test_cases = TestCases(
4747
path=inputs_path,
4848
# test cases for services
49-
services={"googletypes_response", "googletypes_response_embedded", "service"},
49+
services={
50+
"googletypes_response",
51+
"googletypes_response_embedded",
52+
"service",
53+
"import_service_input_message_dependency",
54+
},
5055
xfail=xfail.tests,
5156
)
5257

0 commit comments

Comments
 (0)