-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverify_saas.py
More file actions
91 lines (77 loc) · 2.62 KB
/
verify_saas.py
File metadata and controls
91 lines (77 loc) · 2.62 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
#!/usr/bin/env python3
"""
Verification script for SaaS API modules.
"""
def verify_saas_modules():
"""Verify that all saas modules can be imported correctly.
This function checks imports, abstract classes, and data types.
Returns True if all verifications pass, False otherwise.
"""
try:
# Test saas module imports
from cloud_runtimes.saas.email import EmailRuntimes
from cloud_runtimes.saas.sms import SMSRuntimes
from cloud_runtimes.saas.encryption import EncryptionRuntimes
# Test saas types import
from cloud_runtimes.types.saas import (
SendEmailRequest,
SendEmailResponse,
SendSMSRequest,
SendSMSResponse,
EncryptRequest,
EncryptResponse,
DecryptRequest,
DecryptResponse,
GenerateKeyRequest,
GenerateKeyResponse,
)
print("✅ All saas imports successful!")
# Test abstract class behavior
try:
EmailRuntimes()
print("❌ EmailRuntimes should be abstract!")
except TypeError:
print("✅ EmailRuntimes is properly abstract!")
try:
SMSRuntimes()
print("❌ SMSRuntimes should be abstract!")
except TypeError:
print("✅ SMSRuntimes is properly abstract!")
try:
EncryptionRuntimes()
print("❌ EncryptionRuntimes should be abstract!")
except TypeError:
print("✅ EncryptionRuntimes is properly abstract!")
# Test data type instantiation
email_req = SendEmailRequest(
subject="Test Email",
body="Hello World"
)
print(f"✅ SendEmailRequest created: {email_req.from_} -> {email_req.to[0]}")
sms_req = SendSMSRequest(
from_="+1234567890",
to="+0987654321",
message="Hello SMS"
)
print(f"✅ SendSMSRequest created: {sms_req.from_} -> {sms_req.to}")
encrypt_req = EncryptRequest(data=b"secret data")
print(f"✅ EncryptRequest created with {len(encrypt_req.data)} bytes")
key_req = GenerateKeyRequest(key_type="symmetric", algorithm="AES")
print(f"✅ GenerateKeyRequest created: {key_req.key_type} {key_req.algorithm}")
print("\n🎉 All saas module verifications passed! Python SaaS API modules are working correctly.")
return True
except ImportError as ie:
print(f"❌ Import failed: {ie}")
import traceback
traceback.print_exc()
return False
except Exception as e:
print(f"❌ SaaS verification failed: {e}")
import traceback
traceback.print_exc()
return False
if __name__ == "__main__":
success = verify_saas_modules()
exit(0 if success else 1)