feat(weather): add weather location search
This commit is contained in:
0
tests/common/__init__.py
Normal file
0
tests/common/__init__.py
Normal file
17
tests/common/mock.py
Normal file
17
tests/common/mock.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from pathlib import Path
|
||||
|
||||
from gallery.sketch.source import ApiSource
|
||||
|
||||
|
||||
class MockSource(ApiSource):
|
||||
|
||||
def __init__(self, path: Path, mapping: dict[str, str]):
|
||||
super().__init__("")
|
||||
self._path = path
|
||||
self._mapping = mapping
|
||||
|
||||
async def request(self, endpoint: str) -> str:
|
||||
for pattern, filename in self._mapping.items():
|
||||
if pattern in endpoint:
|
||||
return (self._path / filename).read_text()
|
||||
raise ValueError(endpoint)
|
||||
Reference in New Issue
Block a user