socialseed-e2e 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- socialseed_e2e/__init__.py +51 -0
- socialseed_e2e/__version__.py +21 -0
- socialseed_e2e/cli.py +611 -0
- socialseed_e2e/core/__init__.py +35 -0
- socialseed_e2e/core/base_page.py +839 -0
- socialseed_e2e/core/check_deps.py +43 -0
- socialseed_e2e/core/config.py +119 -0
- socialseed_e2e/core/config_loader.py +604 -0
- socialseed_e2e/core/headers.py +20 -0
- socialseed_e2e/core/interfaces.py +22 -0
- socialseed_e2e/core/loaders.py +51 -0
- socialseed_e2e/core/models.py +24 -0
- socialseed_e2e/core/test_orchestrator.py +84 -0
- socialseed_e2e/services/__init__.py +9 -0
- socialseed_e2e/templates/__init__.py +32 -0
- socialseed_e2e/templates/config.py.template +20 -0
- socialseed_e2e/templates/data_schema.py.template +116 -0
- socialseed_e2e/templates/e2e.conf.template +20 -0
- socialseed_e2e/templates/service_page.py.template +83 -0
- socialseed_e2e/templates/test_module.py.template +46 -0
- socialseed_e2e/utils/__init__.py +44 -0
- socialseed_e2e/utils/template_engine.py +246 -0
- socialseed_e2e/utils/validators.py +588 -0
- socialseed_e2e-0.1.0.dist-info/METADATA +333 -0
- socialseed_e2e-0.1.0.dist-info/RECORD +29 -0
- socialseed_e2e-0.1.0.dist-info/WHEEL +5 -0
- socialseed_e2e-0.1.0.dist-info/entry_points.txt +3 -0
- socialseed_e2e-0.1.0.dist-info/licenses/LICENSE +21 -0
- socialseed_e2e-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def check_dependencies(core_dir: Path):
|
|
7
|
+
"""Checks for illegal imports in the core directory."""
|
|
8
|
+
illegal_patterns = [
|
|
9
|
+
"from services",
|
|
10
|
+
"import services",
|
|
11
|
+
"from verify_services.e2e.services",
|
|
12
|
+
"import verify_services.e2e.services",
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
violations = []
|
|
16
|
+
|
|
17
|
+
for root, _, files in os.walk(core_dir):
|
|
18
|
+
for file in files:
|
|
19
|
+
if file.endswith(".py") and file != "check_deps.py":
|
|
20
|
+
file_path = Path(root) / file
|
|
21
|
+
with open(file_path, "r") as f:
|
|
22
|
+
for i, line in enumerate(f, 1):
|
|
23
|
+
for pattern in illegal_patterns:
|
|
24
|
+
if pattern in line:
|
|
25
|
+
violations.append(
|
|
26
|
+
f"{file_path}:{i} - Illegal import: {line.strip()}"
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
return violations
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
if __name__ == "__main__":
|
|
33
|
+
current_dir = Path(__file__).parent
|
|
34
|
+
violations = check_dependencies(current_dir)
|
|
35
|
+
|
|
36
|
+
if violations:
|
|
37
|
+
print("FAIL: Dependency check failed! Core engine must be agnostic.")
|
|
38
|
+
for v in violations:
|
|
39
|
+
print(v)
|
|
40
|
+
sys.exit(1)
|
|
41
|
+
else:
|
|
42
|
+
print("SUCCESS: Core engine is agnostic (zero-coupling verified).")
|
|
43
|
+
sys.exit(0)
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Configuration module - Unified configuration management.
|
|
3
|
+
|
|
4
|
+
This module provides configuration loading from api.conf file with fallback
|
|
5
|
+
to environment variables for backward compatibility.
|
|
6
|
+
|
|
7
|
+
Usage:
|
|
8
|
+
# Modern approach using api.conf
|
|
9
|
+
from .config_loader import ApiConfigLoader, get_config
|
|
10
|
+
config = ApiConfigLoader.load()
|
|
11
|
+
auth_config = config.services.get("auth")
|
|
12
|
+
|
|
13
|
+
# Legacy approach (still supported)
|
|
14
|
+
from .config import ConfigLoader
|
|
15
|
+
auth_config = ConfigLoader.load_service_config("auth")
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
import os
|
|
19
|
+
from pathlib import Path
|
|
20
|
+
from typing import Dict, Optional
|
|
21
|
+
|
|
22
|
+
from socialseed_e2e.core.config_loader import ApiConfigLoader
|
|
23
|
+
from socialseed_e2e.core.config_loader import get_service_config as _get_service_config
|
|
24
|
+
from socialseed_e2e.core.models import ServiceConfig as OldServiceConfig
|
|
25
|
+
from socialseed_e2e.core.models import TestContext
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class ConfigLoader:
|
|
29
|
+
"""
|
|
30
|
+
Loads configuration from api.conf file with fallback to environment variables.
|
|
31
|
+
|
|
32
|
+
This class maintains backward compatibility while migrating to the new
|
|
33
|
+
api.conf-based configuration system.
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
@staticmethod
|
|
37
|
+
def load_service_config(service_name: str) -> OldServiceConfig:
|
|
38
|
+
"""
|
|
39
|
+
Loads configuration for a specific service.
|
|
40
|
+
|
|
41
|
+
Priority order:
|
|
42
|
+
1. Try to load from api.conf using ApiConfigLoader
|
|
43
|
+
2. Fallback to environment variables
|
|
44
|
+
3. Raise error if not found
|
|
45
|
+
|
|
46
|
+
Args:
|
|
47
|
+
service_name: Name of the service (e.g., "auth", "socialuser")
|
|
48
|
+
|
|
49
|
+
Returns:
|
|
50
|
+
ServiceConfig: Configuration for the service
|
|
51
|
+
|
|
52
|
+
Raises:
|
|
53
|
+
ValueError: If service configuration cannot be found
|
|
54
|
+
"""
|
|
55
|
+
# First, try to load from api.conf
|
|
56
|
+
try:
|
|
57
|
+
new_config = _get_service_config(service_name)
|
|
58
|
+
if new_config:
|
|
59
|
+
# Convert new ServiceConfig to old format for compatibility
|
|
60
|
+
return OldServiceConfig(
|
|
61
|
+
name=new_config.name,
|
|
62
|
+
base_url=new_config.base_url,
|
|
63
|
+
default_headers={
|
|
64
|
+
"Content-Type": "application/json",
|
|
65
|
+
"User-Agent": ApiConfigLoader.load().user_agent,
|
|
66
|
+
**new_config.headers, # Merge service-specific headers
|
|
67
|
+
},
|
|
68
|
+
timeout=new_config.timeout,
|
|
69
|
+
)
|
|
70
|
+
except Exception:
|
|
71
|
+
# If api.conf fails, continue to environment fallback
|
|
72
|
+
pass
|
|
73
|
+
|
|
74
|
+
# Fallback to environment variables (legacy mode)
|
|
75
|
+
prefix = service_name.upper()
|
|
76
|
+
base_url = os.getenv(f"{prefix}_BASE_URL")
|
|
77
|
+
|
|
78
|
+
if not base_url:
|
|
79
|
+
raise ValueError(
|
|
80
|
+
f"Configuration for service '{service_name}' not found. "
|
|
81
|
+
f"Please ensure it exists in api.conf or set {prefix}_BASE_URL environment variable."
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
return OldServiceConfig(
|
|
85
|
+
name=service_name,
|
|
86
|
+
base_url=base_url,
|
|
87
|
+
default_headers={
|
|
88
|
+
"Content-Type": "application/json",
|
|
89
|
+
"User-Agent": os.getenv("E2E_USER_AGENT", "E2E-Agent/1.0"),
|
|
90
|
+
},
|
|
91
|
+
timeout=int(os.getenv(f"{prefix}_TIMEOUT", "30000")),
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
@staticmethod
|
|
95
|
+
def load_test_context() -> TestContext:
|
|
96
|
+
"""Loads the full test context from api.conf or environment."""
|
|
97
|
+
try:
|
|
98
|
+
config = ApiConfigLoader.load()
|
|
99
|
+
return TestContext(
|
|
100
|
+
env=config.environment,
|
|
101
|
+
metadata={
|
|
102
|
+
"project": config.project_name,
|
|
103
|
+
"version": config.project_version,
|
|
104
|
+
"api_gateway_enabled": config.api_gateway.enabled,
|
|
105
|
+
},
|
|
106
|
+
)
|
|
107
|
+
except Exception:
|
|
108
|
+
# Fallback to environment variables
|
|
109
|
+
return TestContext(
|
|
110
|
+
env=os.getenv("E2E_ENV", "dev"),
|
|
111
|
+
metadata={
|
|
112
|
+
"project": "SocialSeed",
|
|
113
|
+
"version": os.getenv("PROJECT_VERSION", "unknown"),
|
|
114
|
+
},
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
# Re-export ApiConfigLoader for convenience
|
|
119
|
+
__all__ = ["ConfigLoader", "ApiConfigLoader"]
|