Skip to content

Commit 30f6742

Browse files
authored
Merge pull request #4 from dbluhm/test/int/schemas
fix: minor fixes for endorser and taa fixtures
2 parents a0fb4f6 + ccd34da commit 30f6742

File tree

2 files changed

+30
-27
lines changed

2 files changed

+30
-27
lines changed

int/tests/conftest.py

+28-26
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import base64
77
from typing import Iterator, Optional
88
from acapy_backchannel.models.conn_record import ConnRecord
9+
from acapy_backchannel.models.did import DID
910
import pytest
1011
import hashlib
1112
import httpx
@@ -182,52 +183,53 @@ async def http_endpoint(agent: BaseAgent):
182183

183184

184185
@pytest.fixture
185-
async def make_did():
186+
async def make_did(backchannel):
186187
"""DID factory fixture"""
187188

188189
async def _make_did():
189-
return await create_did.asyncio(client=backchannel)
190+
return (await create_did.asyncio(client=backchannel)).result
190191

191192
yield _make_did
192193
# TODO create DID deletion method
193194

194195

196+
@pytest.fixture(scope="session")
197+
async def accepted_taa(backchannel):
198+
result = (await fetch_taa.asyncio(client=backchannel)).result
199+
result = await accept_taa.asyncio(
200+
client=backchannel,
201+
json_body=TAAAccept(
202+
mechanism="on_file",
203+
text=result.taa_record.text,
204+
version=result.taa_record.version,
205+
),
206+
)
207+
208+
195209
@pytest.fixture
196-
async def make_endorser_did(make_did):
210+
async def make_endorser_did(make_did, backchannel, accepted_taa):
197211
"""Endorser DID factory fixture"""
198212

199-
def _make_endorser_did():
200-
did = make_did()
213+
async def _make_endorser_did():
214+
did: DID = await make_did()
201215
LOGGER.info("Publishing DID through https://selfserve.indiciotech.io")
202216
response = httpx.post(
203217
url="https://selfserve.indiciotech.io/nym",
204218
json={
205219
"network": "testnet",
206-
"did": did.result.did,
207-
"verkey": did.result.verkey,
220+
"did": did.did,
221+
"verkey": did.verkey,
208222
},
209223
)
210224
if response.is_error:
211-
raise response.error("Failed to publish DID:", response.text)
212-
return
225+
raise Exception("Failed to publish DID:", response.text)
226+
213227
LOGGER.info("DID Published")
228+
result = await set_public_did.asyncio_detailed(
229+
client=backchannel,
230+
did=did.did,
231+
)
232+
assert result.status_code == 200
214233
return did
215234

216235
yield _make_endorser_did
217-
218-
219-
@pytest.fixture(scope="session")
220-
async def accept_taa():
221-
result = await fetch_taa.asyncio(client=issuer).result
222-
result = await accept_taa.asyncio(
223-
client=issuer,
224-
json_body=TAAAccept(
225-
mechanism="on_file",
226-
text=result.taa_record.text,
227-
version=result.taa_record.version,
228-
),
229-
)
230-
result = await set_public_did.asyncio(
231-
client=issuer,
232-
did=did_info.did,
233-
).result

int/tests/test_schemas.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55

66

77
@pytest.mark.asyncio
8-
async def test_send_schema(connection):
8+
async def test_send_schema(connection, make_endorser_did):
99
"""Send a schema and verify message type"""
10+
await make_endorser_did()
1011
try:
1112
schema = await connection.send_and_await_reply_async(
1213
{

0 commit comments

Comments
 (0)