Skip to content

Commit

Permalink
unit test fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Whitehead <[email protected]>
  • Loading branch information
andrewwhitehead committed Dec 13, 2019
1 parent c3c1010 commit a5bfd36
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 3 additions & 3 deletions aries_cloudagent/ledger/tests/test_indy.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ async def test_send_schema(
)

mock_submit.assert_called_once_with(
mock_build_schema_req.return_value, True, True
mock_build_schema_req.return_value, True, sign_did=mock_wallet.get_public_did.return_value
)

assert schema_id == mock_create_schema.return_value[0]
Expand Down Expand Up @@ -329,7 +329,7 @@ async def test_get_schema(
mock_wallet.get_public_did.assert_called_once_with()
mock_build_get_schema_req.assert_called_once_with(mock_did.did, "schema_id")
mock_submit.assert_called_once_with(
mock_build_get_schema_req.return_value, public_did=mock_did.did
mock_build_get_schema_req.return_value, sign_did=mock_did
)
mock_parse_get_schema_req.assert_called_once_with(mock_submit.return_value)

Expand Down Expand Up @@ -424,7 +424,7 @@ async def test_get_credential_definition(
mock_did.did, "cred_def_id"
)
mock_submit.assert_called_once_with(
mock_build_get_cred_def_req.return_value, public_did=mock_did.did
mock_build_get_cred_def_req.return_value, sign_did=mock_did
)
mock_parse_get_cred_def_req.assert_called_once_with(
mock_submit.return_value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,12 @@ async def test_create_free_offer(self):
) as get_cached_key, async_mock.patch.object(
V10CredentialExchange, "set_cached_key", autospec=True
) as set_cached_key:
self.ledger.get_credential_definition = async_mock.CoroutineMock(
return_value={"value": {}}
)
get_cached_key.return_value = None
cred_offer = {"cred_def_id": cred_def_id, "schema_id": schema_id}
issuer = async_mock.MagicMock()
issuer = async_mock.MagicMock(BaseIssuer, autospec=True)
issuer.create_credential_offer = async_mock.CoroutineMock(
return_value=cred_offer
)
Expand Down Expand Up @@ -214,9 +217,12 @@ async def test_create_bound_offer(self):
) as set_cached_key, async_mock.patch.object(
CredentialManager, "_match_sent_cred_def_id", autospec=True
) as match_cred_def_id:
self.ledger.get_credential_definition = async_mock.CoroutineMock(
return_value={"value": {}}
)
get_cached_key.return_value = None
cred_offer = {"cred_def_id": cred_def_id, "schema_id": schema_id}
issuer = async_mock.MagicMock()
issuer = async_mock.MagicMock(BaseIssuer, autospec=True)
issuer.create_credential_offer = async_mock.CoroutineMock(
return_value=cred_offer
)
Expand Down Expand Up @@ -459,7 +465,7 @@ async def test_issue_credential(self):
save_ex.assert_called_once()

issuer.create_credential.assert_called_once_with(
schema, indy_offer, indy_cred_req, cred_values
schema, indy_offer, indy_cred_req, cred_values, None, None
)

assert ret_exchange.credential == cred
Expand Down

0 comments on commit a5bfd36

Please sign in to comment.