- Introduced a comprehensive API contract for the WonderQ-MiniAPP, detailing endpoints for site configuration, product listings, and lead submissions. - Defined data types for various entities including HeroSlide, Destination, Theme, CtaBanner, PublicProduct, and more. - Specified request and response formats, including error handling guidelines. chore: Update requirements to include python-multipart - Added python-multipart dependency to requirements.txt for handling file uploads. test: Implement API contract tests - Created test suite for API contracts, validating serializers and endpoints for public products and leads. - Included tests for destination and product serializers, ensuring correct data handling and validation. test: Add configuration tests for OSS settings - Implemented tests to verify that OSS settings are correctly loaded from environment variables.
16 lines
685 B
Python
16 lines
685 B
Python
from app.config import Settings
|
|
|
|
|
|
def test_oss_settings_are_loaded_from_prefixed_environment(monkeypatch):
|
|
monkeypatch.setenv("OSS_ACCESS_KEY_ID", "example-access-key-id")
|
|
monkeypatch.setenv("OSS_ACCESS_KEY_SECRET", "example-access-key-secret")
|
|
monkeypatch.setenv("OSS_ENDPOINT", "oss-cn-example.aliyuncs.com")
|
|
monkeypatch.setenv("OSS_BUCKET_NAME", "example-bucket")
|
|
|
|
settings = Settings(_env_file=None)
|
|
|
|
assert settings.oss_access_key_id == "example-access-key-id"
|
|
assert settings.oss_access_key_secret == "example-access-key-secret"
|
|
assert settings.oss_endpoint == "oss-cn-example.aliyuncs.com"
|
|
assert settings.oss_bucket_name == "example-bucket"
|