-
Notifications
You must be signed in to change notification settings - Fork 9
/
conftest.py
55 lines (47 loc) · 1.62 KB
/
conftest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
from typing import AsyncGenerator
import pytest
from aries_cloudcontroller import AcaPyClient
# flake8: noqa
# pylint: disable=unused-import
from app.exceptions import CloudApiException
from app.services.acapy_wallet import get_public_did
from app.services.trust_registry.actors import (
fetch_actor_by_id,
register_actor,
remove_actor_by_id,
)
from app.tests.util.credentials import (
issue_alice_creds_and_revoke_published,
issue_alice_creds_and_revoke_unpublished,
issue_credential_to_alice,
meld_co_issue_credential_to_alice,
)
from app.tests.util.definitions import (
credential_definition_id,
credential_definition_id_revocable,
meld_co_credential_definition_id,
schema_definition,
schema_definition_alt,
)
from app.tests.util.ledger import create_public_did
from shared.log_config import get_logger
logger = get_logger(__name__)
# Governance should be provisioned with public did and registered for all e2e tests
@pytest.fixture(autouse=True, scope="session")
async def governance_public_did(
governance_acapy_client: AcaPyClient,
) -> AsyncGenerator[str, None]:
logger.info("Configuring public did for governance")
try:
response = await get_public_did(governance_acapy_client)
except CloudApiException as e:
if e.status_code == 404:
# Did not found, create and publish
response = await create_public_did(governance_acapy_client, set_public=True)
else:
logger.error(
"Something went wrong when fetching public did for governance: {}", e
)
raise e
did = response.did
yield did