GodsDevProject commited on
Commit
28d46cf
·
verified ·
1 Parent(s): 5849c85

Create tests/test_adapters.py

Browse files
Files changed (1) hide show
  1. tests/test_adapters.py +4 -27
tests/test_adapters.py CHANGED
@@ -1,31 +1,8 @@
1
- import inspect
2
- import asyncio
3
  import pytest
4
- from ingest.generic_public_foia import GenericFOIAAdapter
5
  from ingest.registry import get_all_adapters
6
 
7
-
8
- @pytest.mark.asyncio
9
- async def test_all_adapters_compliant():
10
  adapters = get_all_adapters()
11
-
12
- assert adapters, "No adapters registered"
13
-
14
- for name, adapter in adapters.items():
15
- # Must subclass base
16
- assert isinstance(adapter, GenericFOIAAdapter)
17
-
18
- # Must define metadata
19
- assert adapter.source_name != "UNKNOWN"
20
- assert adapter.base_url.startswith("http")
21
-
22
- # Must implement search
23
- assert "search" in dir(adapter)
24
- assert inspect.iscoroutinefunction(adapter.search)
25
-
26
- # Must not raise on empty query
27
- try:
28
- results = await adapter.search("test")
29
- assert isinstance(results, list)
30
- except Exception as e:
31
- pytest.fail(f"{name} adapter failed search(): {e}")
 
 
 
1
  import pytest
 
2
  from ingest.registry import get_all_adapters
3
 
4
+ def test_adapters():
 
 
5
  adapters = get_all_adapters()
6
+ assert adapters
7
+ for a in adapters.values():
8
+ assert hasattr(a, "search")