fmartingr
/
jeeves
Archived
1
0
Fork 0
This repository has been archived on 2021-02-14. You can view files and clone it, but cannot push or open issues or pull requests.
jeeves/jeeves/core/tests/test_registry.py

28 lines
949 B
Python

import pytest
from jeeves.core.registry import ActionRegistry
from jeeves.core.actions.base import Action
from jeeves.core.actions.stub import StubSuccessAction
def test_registry_get_action_cls_ok():
action = ActionRegistry.get_action_cls("jeeves.core.actions.stub:StubSuccessAction")
assert issubclass(action, Action) and not isinstance(action, Action)
def test_registry_get_action_cls_ko():
with pytest.raises(ActionRegistry.ActionDoesNotExist):
ActionRegistry.get_action_cls("non.existant:action")
def test_registry_get_action_ok():
action = ActionRegistry.get_action("jeeves.core.actions.stub:StubSuccessAction")
assert issubclass(action.__class__, Action) and isinstance(action, Action)
def test_registry_namespace_conflict_ok():
ActionRegistry.register_action(StubSuccessAction)
with pytest.raises(ActionRegistry.ActionNamespaceConflict):
ActionRegistry.register_action(StubSuccessAction)