Skip to content

Commit

Permalink
code review fix (removed return value checks from testing)
Browse files Browse the repository at this point in the history
  • Loading branch information
nadinet committed Mar 26, 2021
1 parent 51eee08 commit a31a2d5
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions python/tests/test_seldon_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,6 @@ def mocked_requests_post_success_json_data(url, *args, **kwargs):
return MockResponse(json, 200, text="{}")


def mocked_requests_post_success_raw_data(url, *args, **kwargs):
request = json_to_seldon_message(RAW_DATA_TEST)
json = seldon_message_to_json(request)
return MockResponse(json, 200, text="{}")


@mock.patch("requests.post", side_effect=mocked_requests_post_404)
def test_predict_rest_404(mock_post):
sc = SeldonClient(deployment_name="404")
Expand Down Expand Up @@ -125,7 +119,7 @@ def test_predict_rest_json_data_seldon(mock_post):
assert mock_post.call_count == 1


@mock.patch("requests.post", side_effect=mocked_requests_post_success_raw_data)
@mock.patch("requests.post", side_effect=mocked_requests_post_success)
def test_predict_rest_raw_data_seldon_proto(mock_post):
sc = SeldonClient(
deployment_name="mymodel", gateway="seldon", client_return_type="proto"
Expand All @@ -134,11 +128,10 @@ def test_predict_rest_raw_data_seldon_proto(mock_post):
json_response = seldon_message_to_json(response.response)
assert mock_post.call_args[1]["json"] == RAW_DATA_TEST
assert response.success is True
assert json_response == RAW_DATA_TEST
assert mock_post.call_count == 1


@mock.patch("requests.post", side_effect=mocked_requests_post_success_raw_data)
@mock.patch("requests.post", side_effect=mocked_requests_post_success)
def test_predict_rest_raw_data_gateway_dict(mock_post):
sc = SeldonClient(
deployment_name="mymodel", gateway="istio", client_return_type="dict"
Expand All @@ -147,7 +140,6 @@ def test_predict_rest_raw_data_gateway_dict(mock_post):
json_response = response.response
assert mock_post.call_args[1]["json"] == RAW_DATA_TEST
assert response.success is True
assert json_response == RAW_DATA_TEST
assert mock_post.call_count == 1


Expand Down Expand Up @@ -334,7 +326,6 @@ def test_predict_grpc_proto_raw_data_seldon():
response = sc.predict(raw_data=proto_raw_data, client_return_type="proto")
request = seldon_message_to_json(response.request)
assert request == RAW_DATA_TEST
assert response.response.strData == "predict"


@mock.patch("seldon_core.seldon_client.prediction_pb2_grpc.SeldonStub", new=MyStub)
Expand All @@ -343,7 +334,6 @@ def test_predict_grpc_raw_data_gateway():
response = sc.predict(raw_data=RAW_DATA_TEST, client_return_type="proto")
request = seldon_message_to_json(response.request)
assert request == RAW_DATA_TEST
assert response.response.strData == "predict"


@mock.patch("seldon_core.seldon_client.prediction_pb2_grpc.SeldonStub", new=MyStub)
Expand Down

0 comments on commit a31a2d5

Please sign in to comment.