def test_parse_query_parameters_success(): # Target query separated by equals ('=') char params = _parse_query_parameters({"targets": [{"target": "test=some_test"}]}) assert params["test"] == "some_test" # Target query separated by equals ('=') char (multiple queries) params = _parse_query_parameters( {"targets": [{"target": "test=some_test;another_test=some_other_test"}]} ) assert params["test"] == "some_test" assert params["another_test"] == "some_other_test"
def test_parse_query_parameters_failure(): # No 'targets' in body with pytest.raises(MLRunBadRequestError): _parse_query_parameters({}) # No 'target' list in 'targets' dictionary with pytest.raises(MLRunBadRequestError): _parse_query_parameters({"targets": []}) # Target query not separated by equals ('=') char with pytest.raises(MLRunBadRequestError): _parse_query_parameters({"targets": [{"target": "test"}]})