test(extensions): add unit tests for base extension
This commit is contained in:
1 parent
b6a08ce4e5
commit
a78a6c76f5
2 files changed
+31
No files matched your search
Whitespace-only changes.
@@ -0,0 +1,31 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
from extensions.base_extension import BaseExtension
|
||||||
|
|
||||||
|
|
||||||
|
class ConcreteExtension(BaseExtension):
|
||||||
|
def install_extension(self, **kwargs) -> None:
|
||||||
|
pass
|
||||||
|
|
||||||
|
def remove_extension(self, **kwargs) -> None:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class TestBaseExtension:
|
||||||
|
def test_concrete_subclass_can_be_instantiated(self) -> None:
|
||||||
|
ext = ConcreteExtension({"name": "test"})
|
||||||
|
assert ext.metadata["name"] == "test"
|
||||||
|
|
||||||
|
def test_update_extension_not_implemented(self) -> None:
|
||||||
|
ext = ConcreteExtension({"name": "test"})
|
||||||
|
with pytest.raises(NotImplementedError):
|
||||||
|
ext.update_extension()
|
||||||
|
|
||||||
|
def test_abstract_methods_enforced(self) -> None:
|
||||||
|
class PartialExtension(BaseExtension):
|
||||||
|
def install_extension(self, **kwargs) -> None:
|
||||||
|
pass
|
||||||
|
|
||||||
|
with pytest.raises(TypeError):
|
||||||
|
PartialExtension({"name": "test"})
|
||||||
Reference in new issue
Block a user