old_console/devices/tests/endpoint_utils.py
2024-11-02 14:12:45 +03:00

27 lines
934 B
Python

def mock_vector_service_rise_exception(*args, **kwargs):
"""Mock Vector service interface with creating/updating and destroy method. with raise exception."""
class VectorServiceMock:
def update_config(self):
raise Exception('Update config test mock exception')
def delete_config(self):
raise Exception('Delete config test mock exception')
return VectorServiceMock()
def mock_redis_return_online(*args, **kwargs):
"""Redis interface has endpoint and get_keepalive return True(online)"""
class RedisInterfaceMock:
def get_keepalive(self, pk) -> bool:
return True
return RedisInterfaceMock()
def mock_endpoint_status_service_offline(*args, **kwargs):
"""Endpoint Status Service Return status offline"""
class StatusServiceMock:
def get_status(self) -> dict:
return {'status': 'offline'}
return StatusServiceMock()