Skip to content

Commit d198ee0

Browse files
committed
cli - added unit tests. raise error if no interaction method specified
1 parent 0bc2010 commit d198ee0

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

rsocket/cli/command.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ def get_request_type(request: bool,
152152
if metadata_push:
153153
return RequestType.metadata_push
154154

155+
raise click.UsageError('No interaction method specified (eg. --request)')
156+
155157

156158
@click.command(name='rsocket-py', help='Supported connection strings: tcp/ws/wss')
157159
@click.option('--im', '--interactionModel', 'interaction_model', is_flag=False,

tests/rsocket/test_cli_command.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,17 @@ def test_normalize_data_from_stdin_takes_precedence_over_load_from_file():
108108
assert data == fixture_data_stdin
109109

110110

111-
def test_normalize_limit_rate():
112-
result = normalize_limit_rate(None)
111+
@pytest.mark.parametrize('limit_rate, expected', (
112+
(None, MAX_REQUEST_N),
113+
))
114+
def test_normalize_limit_rate(limit_rate, expected):
115+
result = normalize_limit_rate(limit_rate)
113116

114-
assert result == MAX_REQUEST_N
117+
assert result == expected
115118

116119

117120
@pytest.mark.parametrize('is_request, stream, fnf, metadata_push, channel, interaction_model, expected', (
121+
(None, None, None, None, None, None, Exception),
118122
(True, None, None, None, None, None, RequestType.response),
119123
(None, True, None, None, None, None, RequestType.stream),
120124
(None, None, True, None, None, None, RequestType.fnf),

0 commit comments

Comments
 (0)