31 lines
1.0 KiB
Python
31 lines
1.0 KiB
Python
|
|
"""Tests for the FakeAdapter deterministic in-memory implementation."""
|
||
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
from backend.app.services.c2.adapter import C2Health
|
||
|
|
from backend.app.services.c2.fake import FakeAdapter
|
||
|
|
|
||
|
|
|
||
|
|
class TestFakeAdapterTestConnection:
|
||
|
|
def test_returns_ok_true(self):
|
||
|
|
adapter = FakeAdapter()
|
||
|
|
health = adapter.test_connection()
|
||
|
|
assert isinstance(health, C2Health)
|
||
|
|
assert health.ok is True
|
||
|
|
assert health.error is None
|
||
|
|
|
||
|
|
def test_list_callbacks_returns_list(self):
|
||
|
|
adapter = FakeAdapter()
|
||
|
|
callbacks = adapter.list_callbacks()
|
||
|
|
assert isinstance(callbacks, list)
|
||
|
|
assert len(callbacks) >= 1
|
||
|
|
|
||
|
|
def test_list_callbacks_fields(self):
|
||
|
|
adapter = FakeAdapter()
|
||
|
|
cb = adapter.list_callbacks()[0]
|
||
|
|
assert hasattr(cb, "display_id")
|
||
|
|
assert hasattr(cb, "active")
|
||
|
|
assert hasattr(cb, "host")
|
||
|
|
assert hasattr(cb, "user")
|
||
|
|
assert hasattr(cb, "domain")
|
||
|
|
assert hasattr(cb, "last_checkin")
|