Skip to content

Commit

Permalink
Merge pull request openwallet-foundation#2520 from andrewwhitehead/up…
Browse files Browse the repository at this point in the history
…d/vdr-askar

Update shared components
  • Loading branch information
dbluhm authored Nov 13, 2023
2 parents 9882c47 + af5ebd3 commit afe2da8
Show file tree
Hide file tree
Showing 5 changed files with 119 additions and 244 deletions.
3 changes: 3 additions & 0 deletions aries_cloudagent/admin/tests/test_admin_server.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import gc
import json

import pytest
Expand Down Expand Up @@ -501,6 +502,8 @@ def _smaller_scope():
return test_module.AdminResponder(profile, None)

responder = _smaller_scope()
gc.collect() # help ensure collection of profile

with pytest.raises(RuntimeError):
await responder.send_outbound(None)

Expand Down
9 changes: 6 additions & 3 deletions aries_cloudagent/core/in_memory/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from ...config.injection_context import InjectionContext
from ...config.provider import ClassProvider
from ...storage.base import BaseStorage
from ...storage.base import BaseStorage, BaseStorageSearch
from ...storage.vc_holder.base import VCHolder
from ...utils.classloader import DeferLoad
from ...wallet.base import BaseWallet
Expand All @@ -28,7 +28,6 @@ class InMemoryProfile(Profile):

def __init__(self, *, context: InjectionContext = None, name: str = None):
"""Create a new InMemoryProfile instance."""
global STORAGE_CLASS, WALLET_CLASS
super().__init__(context=context, name=name, created=True)
self.keys = {}
self.local_dids = {}
Expand All @@ -40,6 +39,8 @@ def bind_providers(self):
"""Initialize the profile-level instance providers."""
injector = self._context.injector

injector.bind_instance(BaseStorageSearch, STORAGE_CLASS(self))

injector.bind_provider(
VCHolder,
ClassProvider(
Expand Down Expand Up @@ -114,7 +115,9 @@ async def _setup(self):

def _init_context(self):
"""Initialize the session context."""
self._context.injector.bind_instance(BaseStorage, STORAGE_CLASS(self.profile))
self._context.injector.bind_instance(
BaseStorage, self.profile.inject(BaseStorageSearch)
)
self._context.injector.bind_instance(BaseWallet, WALLET_CLASS(self.profile))

@property
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ async def test_connection_record_without_mediation_metadata(
with mock.patch.object(
storage,
"find_record",
mock.CoroutineMock(raises=StorageNotFoundError),
mock.CoroutineMock(side_effect=StorageNotFoundError),
) as mock_storage_find_record:
handler_inst = handler.ConnectionRequestHandler()
responder = MockResponder()
Expand Down
Loading

0 comments on commit afe2da8

Please sign in to comment.