Skip to content

Commit 5f43992

Browse files
committed
chore: remove issuance v1 unit tests
Signed-off-by: jamshale <[email protected]>
1 parent e4ae0cd commit 5f43992

File tree

8 files changed

+28
-313
lines changed

8 files changed

+28
-313
lines changed

acapy_agent/anoncreds/revocation/tests/test_manager.py

Lines changed: 5 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@
33

44
import pytest
55

6-
from ....protocols.issue_credential.v1_0.models.credential_exchange import (
7-
V10CredentialExchange,
8-
)
96
from ....protocols.issue_credential.v2_0.models.cred_ex_record import V20CredExRecord
10-
from ....revocation.models.issuer_cred_rev_record import IssuerCredRevRecord
117
from ....tests import mock
128
from ....utils.testing import create_test_profile
139
from ...issuer import AnonCredsIssuer
@@ -108,27 +104,6 @@ async def test_revoke_cred_by_cxid_not_found(self):
108104
with self.assertRaises(RevocationManagerError):
109105
await self.manager.revoke_credential_by_cred_ex_id(CRED_EX_ID)
110106

111-
@pytest.mark.skip(reason="AnonCreds-break")
112-
async def test_revoke_credential_no_rev_reg_rec(self):
113-
V10CredentialExchange(
114-
credential_exchange_id="dummy-cxid",
115-
credential_definition_id=CRED_DEF_ID,
116-
role=V10CredentialExchange.ROLE_ISSUER,
117-
revocation_id=CRED_REV_ID,
118-
revoc_reg_id=REV_REG_ID,
119-
)
120-
121-
with mock.patch.object(test_module, "IndyRevocation", autospec=True) as revoc:
122-
revoc.return_value.get_issuer_rev_reg_record = mock.CoroutineMock(
123-
return_value=None
124-
)
125-
126-
issuer = mock.MagicMock(AnonCredsIssuer, autospec=True)
127-
self.profile.context.injector.bind_instance(AnonCredsIssuer, issuer)
128-
129-
with self.assertRaises(RevocationManagerError):
130-
await self.manager.revoke_credential(REV_REG_ID, CRED_REV_ID)
131-
132107
@pytest.mark.skip(reason="AnonCreds-break")
133108
async def test_revoke_credential_pend(self):
134109
mock_issuer_rev_reg_record = mock.MagicMock(mark_pending=mock.AsyncMock())
@@ -417,89 +392,19 @@ async def test_clear_pending_1_rev_reg_some(self):
417392
async def test_retrieve_records(self):
418393
session = await self.profile.session()
419394
for index in range(2):
420-
exchange_record = V10CredentialExchange(
395+
exchange_record = V20CredExRecord(
421396
connection_id=str(index),
422397
thread_id=str(1000 + index),
423-
initiator=V10CredentialExchange.INITIATOR_SELF,
424-
role=V10CredentialExchange.ROLE_ISSUER,
398+
initiator=V20CredExRecord.INITIATOR_SELF,
399+
role=V20CredExRecord.ROLE_ISSUER,
400+
state=V20CredExRecord.STATE_ISSUED,
425401
)
426402
await exchange_record.save(session)
427403

428404
for _ in range(2): # second pass gets from cache
429405
for index in range(2):
430-
ret_ex = await V10CredentialExchange.retrieve_by_connection_and_thread(
406+
ret_ex = await V20CredExRecord.retrieve_by_conn_and_thread(
431407
session, str(index), str(1000 + index)
432408
)
433409
assert ret_ex.connection_id == str(index)
434410
assert ret_ex.thread_id == str(1000 + index)
435-
436-
async def test_set_revoked_state_v1(self):
437-
async with self.profile.session() as session:
438-
exchange_record = V10CredentialExchange(
439-
connection_id="mark-revoked-cid",
440-
thread_id="mark-revoked-tid",
441-
initiator=V10CredentialExchange.INITIATOR_SELF,
442-
revoc_reg_id=REV_REG_ID,
443-
revocation_id=CRED_REV_ID,
444-
role=V10CredentialExchange.ROLE_ISSUER,
445-
state=V10CredentialExchange.STATE_ISSUED,
446-
)
447-
await exchange_record.save(session)
448-
449-
crev_record = IssuerCredRevRecord(
450-
cred_ex_id=exchange_record.credential_exchange_id,
451-
cred_def_id=CRED_DEF_ID,
452-
rev_reg_id=REV_REG_ID,
453-
cred_rev_id=CRED_REV_ID,
454-
state=IssuerCredRevRecord.STATE_ISSUED,
455-
)
456-
await crev_record.save(session)
457-
458-
await self.manager.set_cred_revoked_state(REV_REG_ID, [CRED_REV_ID])
459-
460-
async with self.profile.session() as session:
461-
check_exchange_record = await V10CredentialExchange.retrieve_by_id(
462-
session, exchange_record.credential_exchange_id
463-
)
464-
assert (
465-
check_exchange_record.state
466-
== V10CredentialExchange.STATE_CREDENTIAL_REVOKED
467-
)
468-
469-
check_crev_record = await IssuerCredRevRecord.retrieve_by_id(
470-
session, crev_record.record_id
471-
)
472-
assert check_crev_record.state == IssuerCredRevRecord.STATE_REVOKED
473-
474-
async def test_set_revoked_state_v2(self):
475-
async with self.profile.session() as session:
476-
exchange_record = V20CredExRecord(
477-
connection_id="mark-revoked-cid",
478-
thread_id="mark-revoked-tid",
479-
initiator=V20CredExRecord.INITIATOR_SELF,
480-
role=V20CredExRecord.ROLE_ISSUER,
481-
state=V20CredExRecord.STATE_ISSUED,
482-
)
483-
await exchange_record.save(session)
484-
485-
crev_record = IssuerCredRevRecord(
486-
cred_ex_id=exchange_record.cred_ex_id,
487-
cred_def_id=CRED_DEF_ID,
488-
rev_reg_id=REV_REG_ID,
489-
cred_rev_id=CRED_REV_ID,
490-
state=IssuerCredRevRecord.STATE_ISSUED,
491-
)
492-
await crev_record.save(session)
493-
494-
await self.manager.set_cred_revoked_state(REV_REG_ID, [CRED_REV_ID])
495-
496-
async with self.profile.session() as session:
497-
check_exchange_record = await V20CredExRecord.retrieve_by_id(
498-
session, exchange_record.cred_ex_id
499-
)
500-
assert check_exchange_record.state == V20CredExRecord.STATE_CREDENTIAL_REVOKED
501-
502-
check_crev_record = await IssuerCredRevRecord.retrieve_by_id(
503-
session, crev_record.record_id
504-
)
505-
assert check_crev_record.state == IssuerCredRevRecord.STATE_REVOKED

acapy_agent/core/tests/test_goal_code_registry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from unittest import IsolatedAsyncioTestCase
22

3-
from ...protocols.issue_credential.v1_0.message_types import CONTROLLERS
3+
from ...protocols.issue_credential.v2_0.message_types import CONTROLLERS
44
from ..goal_code_registry import GoalCodeRegistry
55

66

acapy_agent/protocols/discovery/v2_0/handlers/tests/test_queries_handler.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,12 @@
55
from ......core.protocol_registry import ProtocolRegistry
66
from ......messaging.request_context import RequestContext
77
from ......messaging.responder import MockResponder
8-
from ......protocols.issue_credential.v1_0.controller import (
8+
from ......protocols.issue_credential.v2_0.controller import (
99
ISSUE_VC,
1010
PARTICIPATE_VC_INTERACTION,
1111
)
12-
from ......protocols.issue_credential.v1_0.message_types import (
13-
CONTROLLERS as issue_cred_v1_controller,
14-
)
15-
from ......protocols.present_proof.v1_0.message_types import (
16-
CONTROLLERS as pres_proof_v1_controller,
12+
from ......protocols.issue_credential.v2_0.message_types import (
13+
CONTROLLERS as pres_proof_v2_controller,
1714
)
1815
from ......tests import mock
1916
from ......utils.testing import create_test_profile
@@ -32,7 +29,7 @@ async def request_context():
3229
protocol_registry = ProtocolRegistry()
3330
goal_code_registry = GoalCodeRegistry()
3431
protocol_registry.register_message_types({TEST_MESSAGE_TYPE: object()})
35-
goal_code_registry.register_controllers(issue_cred_v1_controller)
32+
goal_code_registry.register_controllers(pres_proof_v2_controller)
3633
profile = ctx.profile
3734
profile.context.injector.bind_instance(ProtocolRegistry, protocol_registry)
3835
profile.context.injector.bind_instance(GoalCodeRegistry, goal_code_registry)
@@ -93,7 +90,7 @@ async def test_queries_protocol_goal_code_all_disclose_list_settings(
9390
protocol_registry.register_message_types({"doc/proto-b/1.0/message": object()})
9491
profile.context.injector.bind_instance(ProtocolRegistry, protocol_registry)
9592
goal_code_registry = profile.inject(GoalCodeRegistry)
96-
goal_code_registry.register_controllers(pres_proof_v1_controller)
93+
goal_code_registry.register_controllers(pres_proof_v2_controller)
9794
profile.context.injector.bind_instance(GoalCodeRegistry, goal_code_registry)
9895
profile.settings["disclose_protocol_list"] = [TEST_MESSAGE_FAMILY]
9996
profile.settings["disclose_goal_code_list"] = [

acapy_agent/protocols/endorse_transaction/v1_0/tests/test_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from .....wallet.base import BaseWallet
1818
from .....wallet.did_method import SOV, DIDMethods
1919
from .....wallet.key_type import ED25519, KeyTypes
20-
from ....issue_credential.v1_0.tests import REV_REG_ID
20+
from ....issue_credential.v2_0.tests import REV_REG_ID
2121
from ..manager import TransactionManager, TransactionManagerError
2222
from ..models.transaction_record import TransactionRecord
2323
from ..transaction_jobs import TransactionJob

acapy_agent/protocols/out_of_band/v1_0/tests/test_manager.py

Lines changed: 1 addition & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,6 @@
3434
from ....coordinate_mediation.v1_0.route_manager import RouteManager
3535
from ....didcomm_prefix import DIDCommPrefix
3636
from ....didexchange.v1_0.manager import DIDXManager
37-
from ....issue_credential.v1_0.message_types import CREDENTIAL_OFFER
38-
from ....issue_credential.v1_0.messages.credential_offer import (
39-
CredentialOffer as V10CredOffer,
40-
)
41-
from ....issue_credential.v1_0.messages.inner.credential_preview import (
42-
CredAttrSpec as V10CredAttrSpec,
43-
)
44-
from ....issue_credential.v1_0.messages.inner.credential_preview import (
45-
CredentialPreview as V10CredentialPreview,
46-
)
47-
from ....issue_credential.v1_0.models.credential_exchange import V10CredentialExchange
48-
from ....issue_credential.v1_0.tests import INDY_OFFER
4937
from ....issue_credential.v2_0.message_types import (
5038
ATTACHMENT_FORMAT as V20_CRED_ATTACH_FORMAT,
5139
)
@@ -56,6 +44,7 @@
5644
V20CredAttrSpec,
5745
V20CredPreview,
5846
)
47+
from ....issue_credential.v2_0.tests import INDY_OFFER
5948
from ....present_proof.v1_0.message_types import ATTACH_DECO_IDS as V10_PRES_ATTACH_FORMAT
6049
from ....present_proof.v1_0.message_types import PRESENTATION_REQUEST
6150
from ....present_proof.v1_0.messages.presentation_request import PresentationRequest
@@ -239,17 +228,6 @@ class TestConfig:
239228
],
240229
)
241230

242-
CRED_OFFER_V1 = V10CredOffer(
243-
credential_preview=V10CredentialPreview(
244-
attributes=(
245-
V10CredAttrSpec(name="legalName", value="value"),
246-
V10CredAttrSpec(name="jurisdictionId", value="value"),
247-
V10CredAttrSpec(name="incorporationDate", value="value"),
248-
)
249-
),
250-
offers_attach=[V10CredOffer.wrap_indy_offer(INDY_OFFER)],
251-
)
252-
253231
CRED_OFFER_V2 = V20CredOffer(
254232
credential_preview=V20CredPreview(
255233
attributes=V20CredAttrSpec.list_plain(
@@ -491,91 +469,11 @@ async def test_create_invitation_no_handshake_no_attachments_x(self):
491469
)
492470
assert "Invitation must include" in str(context.exception)
493471

494-
async def test_create_invitation_attachment_v1_0_cred_offer(self):
495-
self.profile.context.update_settings({"public_invites": True})
496-
with (
497-
mock.patch.object(
498-
AskarWallet, "get_public_did", autospec=True
499-
) as mock_wallet_get_public_did,
500-
mock.patch.object(
501-
V10CredentialExchange,
502-
"retrieve_by_id",
503-
mock.CoroutineMock(),
504-
) as mock_retrieve_cxid,
505-
):
506-
mock_wallet_get_public_did.return_value = DIDInfo(
507-
TestConfig.test_did,
508-
TestConfig.test_verkey,
509-
None,
510-
method=SOV,
511-
key_type=ED25519,
512-
)
513-
mock_retrieve_cxid.return_value = mock.MagicMock(
514-
credential_offer_dict=self.CRED_OFFER_V1
515-
)
516-
invi_rec = await self.manager.create_invitation(
517-
my_endpoint=TestConfig.test_endpoint,
518-
public=True,
519-
hs_protos=[HSProto.RFC23],
520-
multi_use=False,
521-
attachments=[{"type": "credential-offer", "id": "dummy-id"}],
522-
)
523-
524-
mock_retrieve_cxid.assert_called_once_with(ANY, "dummy-id")
525-
assert isinstance(invi_rec, InvitationRecord)
526-
assert invi_rec.invitation.handshake_protocols
527-
assert invi_rec.invitation.requests_attach[0].content[
528-
"@type"
529-
] == DIDCommPrefix.qualify_current(CREDENTIAL_OFFER)
530-
531-
async def test_create_invitation_attachment_v1_0_cred_offer_no_handshake(self):
532-
self.profile.context.update_settings({"public_invites": True})
533-
with (
534-
mock.patch.object(
535-
AskarWallet, "get_public_did", autospec=True
536-
) as mock_wallet_get_public_did,
537-
mock.patch.object(
538-
V10CredentialExchange,
539-
"retrieve_by_id",
540-
mock.CoroutineMock(),
541-
) as mock_retrieve_cxid,
542-
):
543-
mock_wallet_get_public_did.return_value = DIDInfo(
544-
TestConfig.test_did,
545-
TestConfig.test_verkey,
546-
None,
547-
method=SOV,
548-
key_type=ED25519,
549-
)
550-
mock_retrieve_cxid.return_value = mock.MagicMock(
551-
credential_offer_dict=self.CRED_OFFER_V1
552-
)
553-
invi_rec = await self.manager.create_invitation(
554-
my_endpoint=TestConfig.test_endpoint,
555-
public=True,
556-
hs_protos=None,
557-
multi_use=False,
558-
attachments=[{"type": "credential-offer", "id": "dummy-id"}],
559-
)
560-
561-
mock_retrieve_cxid.assert_called_once_with(ANY, "dummy-id")
562-
assert isinstance(invi_rec, InvitationRecord)
563-
assert not invi_rec.invitation.handshake_protocols
564-
assert invi_rec.invitation.requests_attach[0].content == {
565-
**self.CRED_OFFER_V1.serialize(),
566-
"~thread": {"pthid": invi_rec.invi_msg_id},
567-
}
568-
569472
async def test_create_invitation_attachment_v2_0_cred_offer(self):
570473
with (
571474
mock.patch.object(
572475
AskarWallet, "get_public_did", autospec=True
573476
) as mock_wallet_get_public_did,
574-
mock.patch.object(
575-
test_module.V10CredentialExchange,
576-
"retrieve_by_id",
577-
mock.CoroutineMock(),
578-
) as mock_retrieve_cxid_v1,
579477
mock.patch.object(
580478
test_module.V20CredExRecord,
581479
"retrieve_by_id",
@@ -589,7 +487,6 @@ async def test_create_invitation_attachment_v2_0_cred_offer(self):
589487
method=SOV,
590488
key_type=ED25519,
591489
)
592-
mock_retrieve_cxid_v1.side_effect = test_module.StorageNotFoundError()
593490
mock_retrieve_cxid_v2.return_value = mock.MagicMock(cred_offer=V20CredOffer())
594491
invi_rec = await self.manager.create_invitation(
595492
my_endpoint=TestConfig.test_endpoint,

acapy_agent/protocols/present_proof/v1_0/tests/test_manager.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@
1616
)
1717
from .....messaging.decorators.attach_decorator import AttachDecorator
1818
from .....messaging.responder import BaseResponder, MockResponder
19-
from .....protocols.issue_credential.v1_0.models.credential_exchange import (
20-
V10CredentialExchange,
21-
)
2219
from .....tests import mock
2320
from .....utils.testing import create_test_profile
2421
from ....didcomm_prefix import DIDCommPrefix
22+
from ....issue_credential.v2_0.models.cred_ex_record import V20CredExRecord
2523
from ...indy import pres_exch_handler as test_indy_util_module
2624
from .. import manager as test_module
2725
from ..manager import PresentationManager, PresentationManagerError
@@ -1319,7 +1317,7 @@ async def test_receive_problem_report(self):
13191317
)
13201318
save_ex.assert_called_once()
13211319

1322-
assert ret_exchange.state == V10CredentialExchange.STATE_ABANDONED
1320+
assert ret_exchange.state == V20CredExRecord.STATE_ABANDONED
13231321

13241322
async def test_receive_problem_report_x(self):
13251323
connection_id = "connection-id"

0 commit comments

Comments
 (0)