"""V4-M3: FakeGeminiVideoClient unit tests.""" from __future__ import annotations from content_agent.interfaces import GeminiVideoClient from tests.gemini_helpers import ( FakeGeminiVideoClient, fake_gemini_fail, fake_gemini_pool, fake_gemini_review, ) def test_fake_gemini_default_returns_pool(): client = FakeGeminiVideoClient() result = client.analyze({"platform_content_id": "c1"}, {}, {}) assert result["schema_version"] == "v4_gemini_query_relevance.v1" assert result["query_relevance_score"] == 80 assert client.calls[0]["content"]["platform_content_id"] == "c1" def test_fake_gemini_by_content_id_routing(): client = FakeGeminiVideoClient( result_by_content_id={"c1": fake_gemini_review(), "c2": fake_gemini_fail()} ) assert client.analyze({"platform_content_id": "c1"}, {}, {})["query_relevance_score"] == 60 assert client.analyze({"platform_content_id": "c2"}, {}, {})["final_status"] == "failed" assert client.analyze({"platform_content_id": "c3"}, {}, {})["query_relevance_score"] == 80 def test_fake_gemini_records_calls_with_deepcopy(): client = FakeGeminiVideoClient() first = client.analyze({"platform_content_id": "c1"}, {}, {}) first["query_relevance_score"] = "mutated" second = client.analyze({"platform_content_id": "c1"}, {}, {}) assert second["query_relevance_score"] == 80 assert len(client.calls) == 2 def test_fake_gemini_conforms_to_protocol(): client: GeminiVideoClient = FakeGeminiVideoClient() result = client.analyze({"platform_content_id": "c1"}, {"play_url": None}, {"name": "case"}) assert isinstance(result, dict) assert fake_gemini_pool()["query_relevance_score"] == 80