Skip to content

Commit

Permalink
Merge pull request #1000 from axsaucedo/fix_broken_test
Browse files Browse the repository at this point in the history
Fixed test by moving bytes conversion to utils
  • Loading branch information
seldondev authored Oct 26, 2019
2 parents 172aa13 + 7b06eb3 commit 922c804
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 deletions.
3 changes: 0 additions & 3 deletions python/seldon_core/flask_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ def get_request() -> Dict:
raise SeldonMicroserviceException("Can't find JSON in data")
if message is None:
raise SeldonMicroserviceException("Invalid Data Format - empty JSON")
if 'binData' in message and message['binData'] is not None:
binData = message['binData']
message['binData'] = base64.b64decode(binData)
return message


Expand Down
2 changes: 1 addition & 1 deletion python/seldon_core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ def extract_request_parts_json(
features = request["strData"]
elif "binData" in request:
data_type = "binData"
features = bytes(request["binData"])
features = base64.b64decode(request["binData"])
else:
raise SeldonMicroserviceException(f"Invalid request data type: {request}")

Expand Down
3 changes: 1 addition & 2 deletions python/tests/test_combiner_microservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,15 +171,14 @@ def test_aggreate_ok_bindata():
+ bdata_base64
+ '"}]}'
)
bdata_base64_result = base64.b64encode(base64.b64encode(bdata)).decode("utf-8")
print(rv)
j = json.loads(rv.data)
print(j)
assert rv.status_code == 200
assert j["meta"]["tags"] == {"mytag": 1}
assert j["meta"]["metrics"][0]["key"] == user_object.metrics()[0]["key"]
assert j["meta"]["metrics"][0]["value"] == user_object.metrics()[0]["value"]
assert j["binData"] == bdata_base64_result
assert j["binData"] == bdata_base64


def test_aggreate_ok_strdata():
Expand Down

0 comments on commit 922c804

Please sign in to comment.