mirror of
https://github.com/BoPeng/ai-marketplace-monitor.git
synced 2025-12-23 22:28:18 -05:00
fix tests
This commit is contained in:
@@ -10,7 +10,6 @@ from typer.testing import CliRunner
|
||||
import ai_marketplace_monitor
|
||||
from ai_marketplace_monitor import cli
|
||||
from ai_marketplace_monitor.config import Config
|
||||
from ai_marketplace_monitor.utils import MonitorConfig
|
||||
|
||||
runner = CliRunner()
|
||||
|
||||
@@ -297,17 +296,20 @@ def test_config(config_file: Callable, config_content: str, acceptable: bool) ->
|
||||
"searched_count": int,
|
||||
"start_at": (list, type(None)),
|
||||
"username": (str, type(None)),
|
||||
"monitor_config": MonitorConfig,
|
||||
}
|
||||
if acceptable:
|
||||
# print(config_content)
|
||||
config = Config([cfg])
|
||||
# assert the types
|
||||
for key, value in asdict(config.marketplace["facebook"]).items():
|
||||
if key == "monitor_config":
|
||||
continue
|
||||
assert isinstance(value, key_types[key]), f"{key} must be of type {key_types[key]}"
|
||||
|
||||
for item_cfg in config.item.values():
|
||||
for key, value in asdict(item_cfg).items():
|
||||
if key == "monitor_config":
|
||||
continue
|
||||
assert isinstance(value, key_types[key]), f"{key} must be of type {key_types[key]}"
|
||||
# test if all elements can be frozen
|
||||
for attr in ("item", "ai", "user", "marketplae"):
|
||||
|
||||
Reference in New Issue
Block a user