fix(tempo): delegate user-token worklog path to log_worklog so tests can mock it
Aegis CI / lint-and-test (push) Has been cancelled
Snyk Security Scan / Python vulnerabilities (backend) (push) Has been cancelled
Snyk Security Scan / npm vulnerabilities (frontend) (push) Has been cancelled
Snyk Security Scan / Docker image vulnerabilities (backend) (push) Has been cancelled
Aegis CI / lint-and-test (push) Has been cancelled
Snyk Security Scan / Python vulnerabilities (backend) (push) Has been cancelled
Snyk Security Scan / npm vulnerabilities (frontend) (push) Has been cancelled
Snyk Security Scan / Docker image vulnerabilities (backend) (push) Has been cancelled
This commit is contained in:
@@ -291,14 +291,6 @@ def auto_log_test_worklog(
|
|||||||
from tempoapiclient import client_v4 as tempo_client
|
from tempoapiclient import client_v4 as tempo_client
|
||||||
base_url = _get_tempo_base_url(db)
|
base_url = _get_tempo_base_url(db)
|
||||||
tempo = tempo_client.Tempo(auth_token=admin_token, base_url=base_url)
|
tempo = tempo_client.Tempo(auth_token=admin_token, base_url=base_url)
|
||||||
elif has_tempo_configured(user):
|
|
||||||
tempo = get_user_tempo_client(user, db=db)
|
|
||||||
else:
|
|
||||||
logger.debug(
|
|
||||||
"No Tempo credentials available; skipping worklog for test %s", test.id
|
|
||||||
)
|
|
||||||
return None
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result = tempo.create_worklog(
|
result = tempo.create_worklog(
|
||||||
accountId=jira_account_id,
|
accountId=jira_account_id,
|
||||||
@@ -309,6 +301,21 @@ def auto_log_test_worklog(
|
|||||||
)
|
)
|
||||||
except BaseException as exc:
|
except BaseException as exc:
|
||||||
raise RuntimeError(f"Tempo API error: {exc}") from exc
|
raise RuntimeError(f"Tempo API error: {exc}") from exc
|
||||||
|
elif has_tempo_configured(user):
|
||||||
|
result = log_worklog(
|
||||||
|
user,
|
||||||
|
jira_issue_id=int(link.jira_issue_id),
|
||||||
|
author_account_id=jira_account_id,
|
||||||
|
date=work_date,
|
||||||
|
time_spent_seconds=duration_seconds,
|
||||||
|
description=description,
|
||||||
|
db=db,
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
logger.debug(
|
||||||
|
"No Tempo credentials available; skipping worklog for test %s", test.id
|
||||||
|
)
|
||||||
|
return None
|
||||||
|
|
||||||
logger.info(
|
logger.info(
|
||||||
"Tempo worklog created for test %s by user %s: %ds on %s",
|
"Tempo worklog created for test %s by user %s: %ds on %s",
|
||||||
|
|||||||
Reference in New Issue
Block a user