added integration tests and repository pattern for image, model and visual communication DTOs
Code Quality Pipeline / Check Code (pull_request) Failing after 3m21s
Code Quality Pipeline / Check Code (pull_request) Failing after 3m21s
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
from .database_interface import DatabaseInterface
|
||||
from .image_interface import ImageInterface
|
||||
from .model_interface import ModelInterface
|
||||
from .visual_communication_interface import VisualCommunicationInterface
|
||||
@@ -0,0 +1,28 @@
|
||||
"""Definition of DatabaseInterface class."""
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
|
||||
class DatabaseInterface(ABC):
|
||||
"""Interface base class adding 'connect', 'close' and context
|
||||
functionalities."""
|
||||
|
||||
@abstractmethod
|
||||
def connect(self):
|
||||
raise NotImplementedError()
|
||||
|
||||
@abstractmethod
|
||||
def close(self):
|
||||
raise NotImplementedError()
|
||||
|
||||
@abstractmethod
|
||||
def connected(self) -> bool:
|
||||
raise NotImplementedError()
|
||||
|
||||
@abstractmethod
|
||||
def __enter__(self):
|
||||
raise NotImplementedError()
|
||||
|
||||
@abstractmethod
|
||||
def __exit__(self, exc_type, exc_val, exc_tb):
|
||||
raise NotImplementedError()
|
||||
@@ -0,0 +1,26 @@
|
||||
"""Definition of ImageInterface."""
|
||||
|
||||
from abc import abstractmethod
|
||||
|
||||
from ..dto import ImageData
|
||||
from .database_interface import DatabaseInterface
|
||||
|
||||
|
||||
class ImageInterface(DatabaseInterface):
|
||||
"""Image interface class."""
|
||||
|
||||
@abstractmethod
|
||||
def get_data(self, image_name: str) -> ImageData | None:
|
||||
raise NotImplementedError()
|
||||
|
||||
@abstractmethod
|
||||
def put_data(self, data: ImageData) -> None:
|
||||
raise NotImplementedError()
|
||||
|
||||
@abstractmethod
|
||||
def remove_data(self, image_name: str) -> None:
|
||||
raise NotImplementedError()
|
||||
|
||||
@abstractmethod
|
||||
def list_names(self) -> list[str]:
|
||||
raise NotImplementedError()
|
||||
@@ -0,0 +1,26 @@
|
||||
"""Definition of ModelInterface."""
|
||||
|
||||
from abc import abstractmethod
|
||||
|
||||
from ..dto import ModelData
|
||||
from .database_interface import DatabaseInterface
|
||||
|
||||
|
||||
class ModelInterface(DatabaseInterface):
|
||||
"""Model interface class."""
|
||||
|
||||
@abstractmethod
|
||||
def get_data(self, object_name: str) -> ModelData | None:
|
||||
raise NotImplementedError()
|
||||
|
||||
@abstractmethod
|
||||
def put_data(self, data: ModelData) -> None:
|
||||
raise NotImplementedError()
|
||||
|
||||
@abstractmethod
|
||||
def remove_data(self, object_name: str) -> None:
|
||||
raise NotImplementedError()
|
||||
|
||||
@abstractmethod
|
||||
def list_names(self) -> list[str]:
|
||||
raise NotImplementedError()
|
||||
@@ -0,0 +1,26 @@
|
||||
"""Definition of VisualCommunicationInterface."""
|
||||
|
||||
from abc import abstractmethod
|
||||
|
||||
from ..dto import VisualCommunicationData
|
||||
from .database_interface import DatabaseInterface
|
||||
|
||||
|
||||
class VisualCommunicationInterface(DatabaseInterface):
|
||||
"""Visual communication interface class."""
|
||||
|
||||
@abstractmethod
|
||||
def get_data(self, name: str) -> VisualCommunicationData | None:
|
||||
raise NotImplementedError()
|
||||
|
||||
@abstractmethod
|
||||
def put_data(self, data: VisualCommunicationData) -> None:
|
||||
raise NotImplementedError()
|
||||
|
||||
@abstractmethod
|
||||
def remove_data(self, name: str) -> None:
|
||||
raise NotImplementedError()
|
||||
|
||||
@abstractmethod
|
||||
def list_names(self) -> list[str]:
|
||||
raise NotImplementedError()
|
||||
Reference in New Issue
Block a user