add tests and types for pipeline interface
This commit is contained in:
31
tests/test_pipelines.py
Normal file
31
tests/test_pipelines.py
Normal file
@@ -0,0 +1,31 @@
|
||||
import importlib
|
||||
import json
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
import delta_barth.pipelines
|
||||
from delta_barth import pipelines as pl
|
||||
from delta_barth.errors import STATUS_HANDLER
|
||||
|
||||
|
||||
@pytest.mark.new
|
||||
def test_sales_prognosis_pipeline(exmpl_api_sales_prognosis_resp):
|
||||
def mock_request(*args, **kwargs):
|
||||
return exmpl_api_sales_prognosis_resp, STATUS_HANDLER.SUCCESS
|
||||
|
||||
with patch(
|
||||
"delta_barth.api.requests.get_sales_prognosis_data",
|
||||
new=mock_request,
|
||||
):
|
||||
importlib.reload(delta_barth.pipelines)
|
||||
json_resp, json_stat = pl.pipeline_sales_forecast(None, None)
|
||||
|
||||
assert isinstance(json_resp, str)
|
||||
assert isinstance(json_stat, str)
|
||||
parsed_resp = json.loads(json_resp)
|
||||
assert "daten" in parsed_resp
|
||||
assert len(parsed_resp["daten"]) > 0
|
||||
parsed_stat = json.loads(json_stat)
|
||||
assert "code" in parsed_stat
|
||||
assert parsed_stat["code"] == 0
|
||||
Reference in New Issue
Block a user