Skip to content

Commit f219e87

Browse files
committed
Subscription Creation with exact code
1 parent 6b1cd15 commit f219e87

14 files changed

Lines changed: 1526 additions & 4 deletions

debug_subscription.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/usr/bin/env python
2+
import os
3+
import sys
4+
import django
5+
import json
6+
7+
# Setup Django
8+
sys.path.append('src')
9+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'SaoMiguelBus.settings')
10+
django.setup()
11+
12+
from django.test import Client
13+
from django.urls import reverse
14+
15+
def test_subscription_creation():
16+
client = Client()
17+
18+
# Try to get the correct URL
19+
try:
20+
url = reverse('subscriptions:verify_subscription')
21+
print(f"URL resolved to: {url}")
22+
except Exception as e:
23+
print(f"URL resolution error: {e}")
24+
# Let's try the direct URL
25+
url = '/api/v1/subscription/verify'
26+
print(f"Using direct URL: {url}")
27+
28+
# Test data
29+
test_data = {
30+
"email": "test@example.com",
31+
"create_subscription": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v2w3x4y5z6a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v2w3x4y5z6"
32+
}
33+
34+
print(f"Sending request to: {url}")
35+
print(f"Data: {test_data}")
36+
37+
response = client.post(
38+
url,
39+
data=json.dumps(test_data),
40+
content_type="application/json"
41+
)
42+
43+
print(f"Status Code: {response.status_code}")
44+
print(f"Response: {response.content.decode()}")
45+
46+
if __name__ == "__main__":
47+
test_subscription_creation()

0 commit comments

Comments
 (0)