Reorganized test setup to avoid repeated authentication during tests.

This commit is contained in:
2025-11-03 01:07:26 +01:00
parent 54709dd281
commit be2a6870c6
2 changed files with 9 additions and 7 deletions

View File

@@ -1,6 +1,7 @@
import requests
import urllib.parse
from uuid import UUID
from azure.identity import DefaultAzureCredential
DEVOPS_SCOPE = "https://app.vssps.visualstudio.com/.default"
DEVOPS_API_VERSION = "7.1"
@@ -105,7 +106,9 @@ class DevOps():
return entities_list
class Organization(DevOps):
def __init__(self, org_url: str, token: str, api_version: str = DEVOPS_API_VERSION):
def __init__(self, org_url: str, token: str | None = None, api_version: str = DEVOPS_API_VERSION):
if token is None:
token = DefaultAzureCredential().get_token(DEVOPS_SCOPE).token
super().__init__(org_url, token, api_version)
@property