def context():
    """Fixture for context used in tests."""
    # pylint: disable=W0621
    context = RequestContext()
    context.message = ProvideData(goal_code="test_goal", data=[TEST_DATA])
    context.connection_record = ConnectionRecord(connection_id=TEST_CONN_ID)
    context.connection_ready = True
    yield context
Exemple #2
0
    async def test_called(self):
        request_context = RequestContext()
        request_context.connection_record = async_mock.MagicMock()
        request_context.connection_record.connection_id = "dummy"

        handler.save_connection_menu = async_mock.CoroutineMock()
        responder = MockResponder()

        request_context.message = handler.Menu()
        handler_inst = handler.MenuHandler()
        await handler_inst.handle(request_context, responder)

        handler.save_connection_menu.assert_called_once_with(
            request_context.message,
            request_context.connection_record.connection_id,
            request_context,
        )
Exemple #3
0
def context(profile, mock_admin_connection):
    """RequestContext fixture."""
    context = RequestContext(profile)
    context.connection_record = mock_admin_connection
    context.connection_ready = True
    yield context