-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Copyright (c) conda-store development team. All rights reserved. | ||
# Use of this source code is governed by a BSD-style | ||
# license that can be found in the LICENSE file. | ||
|
||
from conda_store_server.plugins.plugin_registry import PluginRegistry | ||
from conda_store_server.plugins import BUILTIN_PLUGINS | ||
|
||
|
||
class TestPlugin(): | ||
@classmethod | ||
def name(cls): | ||
return "test-plugin" | ||
|
||
|
||
def test_register_get_plugin(): | ||
registry = PluginRegistry() | ||
test_plugin = TestPlugin() | ||
registry.register_plugin(test_plugin) | ||
|
||
assert registry.get_plugin("test-plugin") == test_plugin | ||
|
||
|
||
def test_register_list_plugin(): | ||
registry = PluginRegistry() | ||
test_plugin = TestPlugin() | ||
registry.register_plugin(test_plugin) | ||
|
||
assert len(registry.list_plugin_names()) == 1 | ||
assert "test-plugin" in registry.list_plugin_names() | ||
|
||
|
||
def test_collect_plugins(): | ||
registry = PluginRegistry() | ||
registry.collect_plugins() | ||
registered = registry.registered.values() | ||
|
||
for plugin in BUILTIN_PLUGINS: | ||
assert plugin in registered |