-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_setup.py
More file actions
149 lines (111 loc) · 3.89 KB
/
Copy pathtest_setup.py
File metadata and controls
149 lines (111 loc) · 3.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#!/usr/bin/env python3
"""
Quick test script to validate the Project Chimera setup.
"""
import sys
from pathlib import Path
# Add src to path
sys.path.insert(0, str(Path(__file__).parent))
def test_imports():
"""Test that all modules can be imported."""
print("Testing imports...")
try:
from src.config import Settings, get_settings
_ = Settings
_ = get_settings
print("✓ Config module imported")
except ImportError as e:
print(f"✗ Failed to import config: {e}")
return False
try:
from src.contracts.user_binding import BindingRequest, BindingResponse, UserBinding
_ = BindingRequest
_ = BindingResponse
_ = UserBinding
print("✓ User binding contracts imported")
except ImportError as e:
print(f"✗ Failed to import user_binding: {e}")
return False
try:
from src.contracts.discord_interactions import CommandName, InteractionResponse
_ = CommandName
_ = InteractionResponse
print("✓ Discord interaction contracts imported")
except ImportError as e:
print(f"✗ Failed to import discord_interactions: {e}")
return False
try:
from src.adapters.discord_adapter import ChimeraBot, DiscordAdapter
_ = ChimeraBot
_ = DiscordAdapter
print("✓ Discord adapter imported")
except ImportError as e:
print(f"✗ Failed to import discord_adapter: {e}")
return False
return True
def test_pydantic_models():
"""Test that Pydantic models work correctly."""
print("\nTesting Pydantic models...")
from src.contracts.discord_interactions import EmbedColor, InteractionResponse
from src.contracts.user_binding import BindingStatus, UserBinding
try:
# Test UserBinding model
binding = UserBinding(
discord_id="123456789012345678", region="na1", status=BindingStatus.PENDING
)
print(f"✓ UserBinding created: {binding.discord_id}")
# Test InteractionResponse model
response = InteractionResponse(
success=True,
embed_title="Test",
embed_description="Test description",
embed_color=EmbedColor.SUCCESS,
)
print(f"✓ InteractionResponse created: {response.embed_title}")
return True
except Exception as e:
print(f"✗ Model validation failed: {e}")
return False
def test_configuration():
"""Test configuration loading (without actual env vars)."""
print("\nTesting configuration system...")
try:
from src.config import Settings
# Test with mock values (won't actually connect)
settings = Settings(
DISCORD_BOT_TOKEN="MOCK_TOKEN_FOR_TESTING",
DISCORD_APPLICATION_ID="123456789",
RIOT_API_KEY="MOCK_RIOT_KEY",
)
print("✓ Settings object created")
print(f" - Bot token: {'*' * 10} (hidden)")
print(f" - Region: {settings.riot_region}")
print(f" - Debug mode: {settings.debug_mode}")
return True
except Exception as e:
print(f"✗ Configuration failed: {e}")
return False
def main():
"""Run all tests."""
print("=" * 50)
print("Project Chimera Setup Validation")
print("=" * 50)
all_passed = True
if not test_imports():
all_passed = False
if not test_pydantic_models():
all_passed = False
if not test_configuration():
all_passed = False
print("\n" + "=" * 50)
if all_passed:
print("✅ All tests passed! Setup is valid.")
print("\nNext steps:")
print("1. Copy .env.example to .env")
print("2. Add your Discord bot token")
print("3. Run: python main.py")
else:
print("❌ Some tests failed. Please check the errors above.")
print("=" * 50)
if __name__ == "__main__":
main()