Skip to content

Commit

Permalink
Add notes re outstanding work
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Costanzo <[email protected]>
  • Loading branch information
ianco committed Mar 12, 2024
1 parent 22d11e2 commit 18061b2
Show file tree
Hide file tree
Showing 5 changed files with 121 additions and 0 deletions.
10 changes: 10 additions & 0 deletions aries_cloudagent/anoncreds/tests/test_issuer.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,12 @@ async def test_create_credential_offer_create(
assert mock_create.called
assert result is not None

async def test_create_credential_offer_create_vcdi(
self, mock_create, mock_load, mock_session_handle
):
# IC - TODO create a unit test for the new VCDI create offer method
assert False

@mock.patch.object(InMemoryProfileSession, "handle")
@mock.patch.object(Credential, "create", return_value=MockCredential())
async def test_create_credential(self, mock_create, mock_session_handle):
Expand All @@ -762,3 +768,7 @@ async def test_create_credential(self, mock_create, mock_session_handle):
assert result is not None
assert mock_session_handle.fetch.called
assert mock_create.called

async def test_create_credential_vcdi(self, mock_create, mock_session_handle):
# IC - TODO create a unit test for the new VCDI create credential method
assert False
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,11 @@ async def create_offer(

async def _create():
# TODO - implement a separate create_credential_offer for vcdi
# IC - need to create a new "issuer.create_credential_offer_vc_di()"
# method that creates the offer in the new format, and then
# call it from here (instead of "issuer.create_credential_offer()")
# (see the corresponding method in "formats/indy/handler.py", the new method
# should work basically the same way, except using the new VCDI format)
offer_json = await issuer.create_credential_offer(cred_def_id)
return json.loads(offer_json)

Expand Down Expand Up @@ -346,7 +351,13 @@ async def issue_credential(
)
detail_proof = VCDICredRequest.deserialize(binding_proof)
manager = self.profile.inject(VcLdpManager)

# TODO - implement a separate create_credential for vcdi
# IC - I think this is the new "issuer.create_credential_vc_di()" method that
# has been implemented already; it needs to be called from here somewhere
# (see the corresponding method in "formats/indy/handler.py", the new method
# should work basically the same way, except using the new VCDI format)

assert detail_credential.credential and isinstance(
detail_credential.credential, VerifiableCredential
)
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
from copy import deepcopy
from time import time
import json
from unittest import IsolatedAsyncioTestCase
from aries_cloudagent.tests import mock
from marshmallow import ValidationError

from .. import handler as test_module

from .......core.in_memory import InMemoryProfile
from .......ledger.base import BaseLedger
from .......ledger.multiple_ledger.ledger_requests_executor import (
IndyLedgerRequestsExecutor,
)
from .......multitenant.base import BaseMultitenantManager
from .......multitenant.manager import MultitenantManager
from .......cache.in_memory import InMemoryCache
from .......cache.base import BaseCache
from .......storage.record import StorageRecord
from .......messaging.credential_definitions.util import CRED_DEF_SENT_RECORD_TYPE
from .......messaging.decorators.attach_decorator import AttachDecorator
from .......indy.holder import IndyHolder
from ....models.cred_ex_record import V20CredExRecord
from ....message_types import (
ATTACHMENT_FORMAT,
CRED_20_PROPOSAL,
CRED_20_OFFER,
CRED_20_REQUEST,
CRED_20_ISSUE,
)

from ...handler import V20CredFormatError

from ..handler import VCDICredFormatHandler
from ..handler import LOGGER as INDY_LOGGER

# setup any required test data, see "formats/indy/tests/test_handler.py"
# ...


# IC - these are the minimal unit tests required for the new VCDI format class
# they should verify that the formatter generates and receives/handles
# credential offers/requests/issues with the new VCDI format
# (see "formats/indy/tests/test_handler.py" for the unit tests for the
# existing Indy tests, these should work basically the same way)

class TestV20VCDICredFormatHandler(IsolatedAsyncioTestCase):
async def asyncSetUp(self):
# any required setup, see "formats/indy/tests/test_handler.py"
pass

async def test_validate_fields(self):
# Test correct data
# any required tests, see "formats/indy/tests/test_handler.py"
assert False

async def test_get_indy_detail_record(self):
# any required tests, see "formats/indy/tests/test_handler.py"
assert False

async def test_check_uniqueness(self):
# any required tests, see "formats/indy/tests/test_handler.py"
assert False

async def test_create_offer(self):
# any required tests, see "formats/indy/tests/test_handler.py"
assert False

async def test_receive_offer(self):
# any required tests, see "formats/indy/tests/test_handler.py"
assert False

async def test_create_request(self):
# any required tests, see "formats/indy/tests/test_handler.py"
assert False

async def test_receive_request(self):
# any required tests, see "formats/indy/tests/test_handler.py"
assert False

async def test_issue_credential_revocable(self):
# any required tests, see "formats/indy/tests/test_handler.py"
assert False

async def test_issue_credential_non_revocable(self):
# any required tests, see "formats/indy/tests/test_handler.py"
assert False

Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,10 @@ async def test_credential_exchange_send_free_offer(self):
await test_module.credential_exchange_send_free_offer(self.request)
mock_response.assert_called_once_with(mock_cx_rec.serialize.return_value)

async def test_credential_exchange_send_free_offer_vcdr(self):
# IC - TODO test offer with new VCDI format
assert False

async def test_credential_exchange_send_free_offer_no_filter(self):
self.request.json = mock.CoroutineMock(
return_value={
Expand Down Expand Up @@ -981,6 +985,10 @@ async def test_credential_exchange_send_request(self):

mock_response.assert_called_once_with(mock_cx_rec.serialize.return_value)

async def test_credential_exchange_send_request_vcdr(self):
# IC - TODO test request with new VCDI format
assert False

async def test_credential_exchange_send_request_bad_cred_ex_id(self):
self.request.json = mock.CoroutineMock()
self.request.match_info = {"cred_ex_id": "dummy"}
Expand Down Expand Up @@ -1218,6 +1226,10 @@ async def test_credential_exchange_issue(self):
}
)

async def test_credential_exchange_issue_vcdr(self):
# IC - TODO test issue with new VCDI format
assert False

async def test_credential_exchange_issue_bad_cred_ex_id(self):
self.request.json = mock.CoroutineMock()
self.request.match_info = {"cred_ex_id": "dummy"}
Expand Down

0 comments on commit 18061b2

Please sign in to comment.