How to use the ariadne.ExtensionManager function in ariadne

To help you get started, we’ve selected a few ariadne examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mirumee / ariadne / tests / test_extensions.py View on Github external
def test_extension_format_is_called_with_context():
    extension = Mock(spec=Extension, format=Mock(return_value={"a": 1}))
    manager = ExtensionManager([Mock(return_value=extension)], context)
    manager.format()
    extension.format.assert_called_once_with(context)
github mirumee / ariadne / tests / test_extensions.py View on Github external
def test_request_finished_event_is_called_by_extension_manager():
    extension = Mock(spec=Extension)
    manager = ExtensionManager([Mock(return_value=extension)], context)
    with manager.request():
        pass

    extension.request_finished.assert_called_once_with(context)
github mirumee / ariadne / tests / test_extensions_sync.py View on Github external
def test_extension_format_is_called_with_context():
    extension = Mock(spec=ExtensionSync, format=Mock(return_value={"a": 1}))
    manager = ExtensionManager([Mock(return_value=extension)], context)
    manager.format()
    extension.format.assert_called_once_with(context)
github mirumee / ariadne / tests / test_extensions.py View on Github external
def test_request_started_event_is_called_by_extension_manager():
    extension = Mock(spec=Extension)
    manager = ExtensionManager([Mock(return_value=extension)], context)
    with manager.request():
        pass

    extension.request_started.assert_called_once_with(context)
github mirumee / ariadne / tests / test_extensions_sync.py View on Github external
def test_has_errors_event_is_called_with_errors_list_and_context():
    extension = Mock(spec=ExtensionSync)
    manager = ExtensionManager([Mock(return_value=extension)], context)
    manager.has_errors([exception])
    extension.has_errors.assert_called_once_with([exception], context)
github mirumee / ariadne / tests / test_extensions_sync.py View on Github external
def test_request_started_event_is_called_by_extension_manager():
    extension = Mock(spec=ExtensionSync)
    manager = ExtensionManager([Mock(return_value=extension)], context)
    with manager.request():
        pass

    extension.request_started.assert_called_once_with(context)
github mirumee / ariadne / tests / test_extensions.py View on Github external
def test_extensions_are_formatted():
    extensions = [
        Mock(spec=Extension, format=Mock(return_value={"a": 1})),
        Mock(spec=Extension, format=Mock(return_value={"b": 2})),
    ]
    manager = ExtensionManager([Mock(return_value=ext) for ext in extensions])
    assert manager.format() == {"a": 1, "b": 2}
github mirumee / ariadne / tests / test_extensions.py View on Github external
def test_has_errors_event_is_called_with_errors_list_and_context():
    extension = Mock(spec=Extension)
    manager = ExtensionManager([Mock(return_value=extension)], context)
    manager.has_errors([exception])
    extension.has_errors.assert_called_once_with([exception], context)
github mirumee / ariadne / tests / test_extensions_sync.py View on Github external
def test_request_finished_event_is_called_by_extension_manager():
    extension = Mock(spec=ExtensionSync)
    manager = ExtensionManager([Mock(return_value=extension)], context)
    with manager.request():
        pass

    extension.request_finished.assert_called_once_with(context)
github mirumee / ariadne / tests / test_extensions_sync.py View on Github external
def test_extensions_are_formatted():
    extensions = [
        Mock(spec=ExtensionSync, format=Mock(return_value={"a": 1})),
        Mock(spec=ExtensionSync, format=Mock(return_value={"b": 2})),
    ]
    manager = ExtensionManager([Mock(return_value=ext) for ext in extensions], context)
    assert manager.format() == {"a": 1, "b": 2}