Spaces:
Sleeping
Sleeping
Create tests/test_adapter_compliance.py
Browse files
tests/test_adapter_compliance.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pytest
|
| 2 |
+
from ingest.registry import get_enabled_adapters
|
| 3 |
+
|
| 4 |
+
def test_adapters_public_safe():
|
| 5 |
+
adapters = get_enabled_adapters(enable_live=False)
|
| 6 |
+
for a in adapters:
|
| 7 |
+
assert hasattr(a, "search")
|
| 8 |
+
assert hasattr(a, "source_name")
|
| 9 |
+
assert a.base_url.startswith("http")
|
| 10 |
+
|
| 11 |
+
@pytest.mark.asyncio
|
| 12 |
+
async def test_search_returns_list():
|
| 13 |
+
adapters = get_enabled_adapters(enable_live=False)
|
| 14 |
+
for a in adapters:
|
| 15 |
+
res = await a.search("test")
|
| 16 |
+
assert isinstance(res, list)
|