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,25 +291,32 @@ def auto_log_test_worklog(
|
||||
from tempoapiclient import client_v4 as tempo_client
|
||||
base_url = _get_tempo_base_url(db)
|
||||
tempo = tempo_client.Tempo(auth_token=admin_token, base_url=base_url)
|
||||
try:
|
||||
result = tempo.create_worklog(
|
||||
accountId=jira_account_id,
|
||||
issueId=int(link.jira_issue_id),
|
||||
dateFrom=work_date,
|
||||
timeSpentSeconds=duration_seconds,
|
||||
description=description,
|
||||
)
|
||||
except BaseException as exc:
|
||||
raise RuntimeError(f"Tempo API error: {exc}") from exc
|
||||
elif has_tempo_configured(user):
|
||||
tempo = get_user_tempo_client(user, db=db)
|
||||
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
|
||||
|
||||
try:
|
||||
result = tempo.create_worklog(
|
||||
accountId=jira_account_id,
|
||||
issueId=int(link.jira_issue_id),
|
||||
dateFrom=work_date,
|
||||
timeSpentSeconds=duration_seconds,
|
||||
description=description,
|
||||
)
|
||||
except BaseException as exc:
|
||||
raise RuntimeError(f"Tempo API error: {exc}") from exc
|
||||
|
||||
logger.info(
|
||||
"Tempo worklog created for test %s by user %s: %ds on %s",
|
||||
test.id, getattr(user, "username", user), duration_seconds, work_date,
|
||||
|
||||
Reference in New Issue
Block a user