from GramAddict.core.config import Config


def test_config_plugin_section():
    # Mock config
    config = Config(first_run=True, **{})
    config.config = {"plugins": {"dummy_plugin": {"enabled": False, "percentage": 50}}}
    config.args = type("Args", (), {})()

    # We should be able to get the plugin config
    plugin_config = config.get_plugin_config("dummy_plugin")
    assert plugin_config == {"enabled": False, "percentage": 50}


def test_config_plugin_fallback():
    config = Config(first_run=True, **{})
    config.config = {}
    config.args = type("Args", (), {"dummy_plugin_percentage": 75, "dummy_plugin_enabled": True})()

    plugin_config = config.get_plugin_config("dummy_plugin")
    assert plugin_config == {"percentage": 75}


def test_config_plugin_not_found():
    config = Config(first_run=True, **{})
    config.config = {}
    config.args = type("Args", (), {})()

    # Non-existent plugin should return empty dict
    plugin_config = config.get_plugin_config("nonexistent")
    assert plugin_config == {}
