QRC and GUI Test #4
This commit is contained in:
1 parent
828534c1f5
commit
15a716d107
11 files changed
+628
-6
No files matched your search
@@ -8,6 +8,41 @@ from mcc.core.plugin_registry import (
|
||||
RegistryEntry,
|
||||
)
|
||||
|
||||
from mcc.core.static_plugin_provider import StaticRegistryProvider
|
||||
|
||||
|
||||
def test_static_provider_returns_configured_entries() -> None:
|
||||
"""The static provider returns only the entries configured in code."""
|
||||
entries = (
|
||||
RegistryEntry(
|
||||
plugin_id="org.mageia.mcc.example",
|
||||
manifest_path="/plugins/example-readonly/plugin.json",
|
||||
),
|
||||
)
|
||||
provider = StaticRegistryProvider(registered_entries=entries)
|
||||
|
||||
assert provider.entries() == list(entries)
|
||||
|
||||
|
||||
def test_registry_loads_plugin_from_static_provider(tmp_path: Path) -> None:
|
||||
"""The registry can load a manifest supplied by the static provider."""
|
||||
plugin_id = "org.mageia.mcc.example"
|
||||
manifest_path = tmp_path / "plugin.json"
|
||||
write_manifest(manifest_path, plugin_id)
|
||||
provider = StaticRegistryProvider(
|
||||
registered_entries=(
|
||||
RegistryEntry(
|
||||
plugin_id=plugin_id,
|
||||
manifest_path=str(manifest_path),
|
||||
),
|
||||
)
|
||||
)
|
||||
|
||||
result = PluginRegistry(provider).load()
|
||||
|
||||
assert [plugin.plugin_id for plugin in result.plugins] == [plugin_id]
|
||||
assert result.errors == ()
|
||||
|
||||
|
||||
class FakeProvider:
|
||||
"""Test provider that returns a fixed list of registered entries."""
|
||||
|
||||
Reference in new issue
Block a user