test(extensions): add unit tests for base extension

This commit is contained in:
dw-0
2026-07-11 17:49:51 +02:00
parent b6a08ce4e5
commit a78a6c76f5
2 changed files with 31 additions and 0 deletions
View File
@@ -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"})