The tenant ID should be hashed and used as the key for the JSON blob of relevant creds for any given tenant. Azure CSP interface methods that need to source creds should call the internal `_source_creds` method, either with a `tenant_id` or no parameters. That method will source the creds. If a tenant ID is provided, it will source them from the Key Vault. If not provided, it will return the default creds for the app registration in the home tenant.
17 lines
393 B
Python
17 lines
393 B
Python
import random
|
|
import re
|
|
import string
|
|
|
|
from atst.utils import sha256_hex
|
|
|
|
|
|
def test_sha256_hex():
|
|
sample = "".join(
|
|
random.choices(string.ascii_uppercase + string.digits, k=random.randrange(200))
|
|
)
|
|
hashed = sha256_hex(sample)
|
|
assert re.match("^[a-zA-Z0-9]+$", hashed)
|
|
assert len(hashed) == 64
|
|
hashed_again = sha256_hex(sample)
|
|
assert hashed == hashed_again
|