add login check for first request execution
This commit is contained in:
parent
77b4bd9700
commit
e57d39c416
@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "delta-barth"
|
name = "delta-barth"
|
||||||
version = "0.5.9dev1"
|
version = "0.5.9dev2"
|
||||||
description = "workflows and pipelines for the Python-based Plugin of Delta Barth's ERP system"
|
description = "workflows and pipelines for the Python-based Plugin of Delta Barth's ERP system"
|
||||||
authors = [
|
authors = [
|
||||||
{name = "Florian Förster", email = "f.foerster@d-opt.com"},
|
{name = "Florian Förster", email = "f.foerster@d-opt.com"},
|
||||||
@ -74,7 +74,7 @@ directory = "reports/coverage"
|
|||||||
|
|
||||||
|
|
||||||
[tool.bumpversion]
|
[tool.bumpversion]
|
||||||
current_version = "0.5.9dev1"
|
current_version = "0.5.9dev2"
|
||||||
parse = """(?x)
|
parse = """(?x)
|
||||||
(?P<major>0|[1-9]\\d*)\\.
|
(?P<major>0|[1-9]\\d*)\\.
|
||||||
(?P<minor>0|[1-9]\\d*)\\.
|
(?P<minor>0|[1-9]\\d*)\\.
|
||||||
|
|||||||
@ -66,6 +66,11 @@ def get_sales_prognosis_data(
|
|||||||
BuchungsDatum=start_date,
|
BuchungsDatum=start_date,
|
||||||
)
|
)
|
||||||
empty_response = SalesPrognosisResponse(daten=tuple())
|
empty_response = SalesPrognosisResponse(daten=tuple())
|
||||||
|
if not session.logged_in:
|
||||||
|
_, status = session.login()
|
||||||
|
if status != STATUS_HANDLER.SUCCESS:
|
||||||
|
return empty_response, status
|
||||||
|
|
||||||
resp: Response | None = None
|
resp: Response | None = None
|
||||||
try:
|
try:
|
||||||
for attempt in range(1, (MAX_LOGIN_RETRIES + 1)):
|
for attempt in range(1, (MAX_LOGIN_RETRIES + 1)):
|
||||||
|
|||||||
@ -8,9 +8,8 @@ from delta_barth.api import requests as requests_
|
|||||||
|
|
||||||
@pytest.mark.api_con_required
|
@pytest.mark.api_con_required
|
||||||
def test_get_sales_prognosis_data_Success(session):
|
def test_get_sales_prognosis_data_Success(session):
|
||||||
resp, status = session.login()
|
# do not login: let routine do it
|
||||||
# test without company ID
|
# test without company ID
|
||||||
assert status.code == 0
|
|
||||||
date = Datetime(2023, 12, 15)
|
date = Datetime(2023, 12, 15)
|
||||||
resp, status = requests_.get_sales_prognosis_data(session, None, date)
|
resp, status = requests_.get_sales_prognosis_data(session, None, date)
|
||||||
assert status.code == 0
|
assert status.code == 0
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user