def test_predict_rest(mock_post):
    filename = os.path.join(RESOURCES_PATH, "model-template-app",
                            "contract.json")
    args_dict = {
        "contract": filename,
        "host": "a",
        "port": 1000,
        "n_requests": 1,
        "batch_size": 1,
        "endpoint": "predict",
        "prnt": True,
        "grpc": False,
        "tensor": True,
        "deployment": "abc",
        "namespace": None,
    }
    args = Bunch(args_dict)
    run_predict(args)
    logging.info(mock_post.call_args)
    assert mock_post.call_args[1]["json"]["data"]["names"] == [
        "sepal_length",
        "sepal_width",
        "petal_length",
        "petal_width",
    ]
Example #2
0
def test_predict_rest(mock_post):
    filename = join(dirname(__file__), "model-template-app", "contract.json")
    args_dict = {
        "contract": filename,
        "host": "a",
        "port": 1000,
        "n_requests": 1,
        "batch_size": 1,
        "endpoint": "predict",
        "prnt": True,
        "grpc": False,
        "tensor": True,
        "oauth_key": None,
        "oauth_secret": None,
        "deployment": "abc",
        "namespace": None,
    }
    args = Bunch(args_dict)
    run_predict(args)
    print(mock_post.call_args)
    assert mock_post.call_args[1]["json"]["data"]["names"] == [
        "sepal_length",
        "sepal_width",
        "petal_length",
        "petal_width",
    ]
Example #3
0
def test_predict_rest(mock_post):
    filename = join(dirname(__file__), "model-template-app", "contract.json")
    args_dict = {"contract": filename, "host": "a", "port": 1000, "n_requests": 1, "batch_size": 1,
                 "endpoint": "predict", "prnt": True,
                 "grpc": False, "tensor": True, "oauth_key": None, "oauth_secret": None, "deployment": "abc",
                 "namespace": None}
    args = Bunch(args_dict)
    run_predict(args)