# -*- coding: utf-8 -*-
"""配置管理测试"""
import pytest
from config.settings import AppConfig
from config.defaults import DEFAULTS

def test_config_load():
    """测试配置加载"""
    config = AppConfig.load({"app": {"store_id": 1}})
    assert config.get("app.timezone") == DEFAULTS["app"]["timezone"]

def test_config_override():
    """测试配置覆盖"""
    overrides = {
        "app": {"store_id": 12345}
    }
    config = AppConfig.load(overrides)
    assert config.get("app.store_id") == 12345

def test_config_get_nested():
    """测试嵌套配置获取"""
    config = AppConfig.load({"app": {"store_id": 1}})
    assert config.get("db.batch_size") == 1000
    assert config.get("nonexistent.key", "default") == "default"
