async def setup(session: ProfileSession,
                protocol_registry: ProtocolRegistry = None):
    """Setup the connections plugin."""
    if not protocol_registry:
        protocol_registry = session.inject(ProtocolRegistry)

    protocol_registry.register_message_types(MESSAGE_TYPES)
Пример #2
0
async def setup(context: InjectionContext,
                protocol_registry: ProtocolRegistry = None):
    """Setup the connections plugin."""
    if not protocol_registry:
        protocol_registry = await context.inject(ProtocolRegistry)

    protocol_registry.register_message_types(MESSAGE_TYPES)
    async def test_disclose(self):
        ctx = RequestContext()
        registry = ProtocolRegistry()
        registry.register_message_types({TEST_MESSAGE_TYPE: object()})
        ctx.injector.bind_instance(ProtocolRegistry, registry)
        ctx.message = Disclose(protocols=[{
            "pid": "did:sov:BzCbsNYhMrjHiqZDTUASHg;test_proto/test_message",
            "roles": [],
        }])

        handler = DiscloseHandler()
        mock_responder = MockResponder()
        await handler.handle(ctx, mock_responder)
        assert not mock_responder.messages
Пример #4
0
def profile(event_bus, mock_responder):
    """Profile fixture."""
    yield InMemoryProfile.test_profile(bind={
        BaseResponder: mock_responder,
        ProtocolRegistry: ProtocolRegistry(),
    })
Пример #5
0
def request_context() -> RequestContext:
    ctx = RequestContext()
    registry = ProtocolRegistry()
    registry.register_message_types({TEST_MESSAGE_TYPE: object()})
    ctx.injector.bind_instance(ProtocolRegistry, registry)
    yield ctx