Refactor test cases for improved readability and consistency
- Updated test functions in various test files to enhance code clarity by formatting long lines and improving indentation. - Adjusted assertions to use multi-line formatting for better readability. - Added new test cases for theme settings API to ensure proper functionality. - Ensured consistent use of line breaks and spacing across test files for uniformity.
This commit is contained in:
@@ -4,6 +4,7 @@ import time
|
||||
from typing import Dict, Generator
|
||||
|
||||
import pytest
|
||||
|
||||
# type: ignore[import]
|
||||
from playwright.sync_api import Browser, Page, Playwright, sync_playwright
|
||||
|
||||
@@ -70,10 +71,17 @@ def seed_default_currencies(live_server: str) -> None:
|
||||
|
||||
seeds = [
|
||||
{"code": "EUR", "name": "Euro", "symbol": "EUR", "is_active": True},
|
||||
{"code": "CLP", "name": "Chilean Peso", "symbol": "CLP$", "is_active": True},
|
||||
{
|
||||
"code": "CLP",
|
||||
"name": "Chilean Peso",
|
||||
"symbol": "CLP$",
|
||||
"is_active": True,
|
||||
},
|
||||
]
|
||||
|
||||
with httpx.Client(base_url=live_server, timeout=5.0, trust_env=False) as client:
|
||||
with httpx.Client(
|
||||
base_url=live_server, timeout=5.0, trust_env=False
|
||||
) as client:
|
||||
try:
|
||||
response = client.get("/api/currencies/?include_inactive=true")
|
||||
response.raise_for_status()
|
||||
@@ -128,8 +136,12 @@ def page(browser: Browser, live_server: str) -> Generator[Page, None, None]:
|
||||
def _prepare_database_environment(env: Dict[str, str]) -> Dict[str, str]:
|
||||
"""Ensure granular database env vars are available for the app under test."""
|
||||
|
||||
required = ("DATABASE_HOST", "DATABASE_USER",
|
||||
"DATABASE_NAME", "DATABASE_PASSWORD")
|
||||
required = (
|
||||
"DATABASE_HOST",
|
||||
"DATABASE_USER",
|
||||
"DATABASE_NAME",
|
||||
"DATABASE_PASSWORD",
|
||||
)
|
||||
if all(env.get(key) for key in required):
|
||||
return env
|
||||
|
||||
|
||||
Reference in New Issue
Block a user