Ejemplo n.º 1
0
def test_manager_serve_list_of_payment_gateways():
    expected_gateway = {
        "name": ActivePaymentGateway.PLUGIN_NAME,
        "config": ActivePaymentGateway.CLIENT_CONFIG,
    }
    plugins = [
        "tests.plugins.sample_plugins.PluginSample",
        "tests.plugins.sample_plugins.ActivePaymentGateway",
        "tests.plugins.sample_plugins.InactivePaymentGateway",
    ]
    manager = PluginsManager(plugins=plugins)
    assert manager.list_payment_gateways() == [expected_gateway]
def test_manager_serve_list_all_payment_gateways():
    expected_gateways = [
        {
            "name": ActivePaymentGateway.PLUGIN_NAME,
            "config": ActivePaymentGateway.CLIENT_CONFIG,
        },
        {"name": InactivePaymentGateway.PLUGIN_NAME, "config": []},
    ]

    plugins = [
        "tests.plugins.sample_plugins.ActivePaymentGateway",
        "tests.plugins.sample_plugins.InactivePaymentGateway",
    ]
    manager = PluginsManager(plugins=plugins)
    assert manager.list_payment_gateways(active_only=False) == expected_gateways