-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdebug_subscription.py
More file actions
47 lines (38 loc) · 1.22 KB
/
debug_subscription.py
File metadata and controls
47 lines (38 loc) · 1.22 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
#!/usr/bin/env python
import os
import sys
import django
import json
# Setup Django
sys.path.append('src')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'SaoMiguelBus.settings')
django.setup()
from django.test import Client
from django.urls import reverse
def test_subscription_creation():
client = Client()
# Try to get the correct URL
try:
url = reverse('subscriptions:verify_subscription')
print(f"URL resolved to: {url}")
except Exception as e:
print(f"URL resolution error: {e}")
# Let's try the direct URL
url = '/api/v1/subscription/verify'
print(f"Using direct URL: {url}")
# Test data
test_data = {
"email": "test@example.com",
"create_subscription": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v2w3x4y5z6a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v2w3x4y5z6"
}
print(f"Sending request to: {url}")
print(f"Data: {test_data}")
response = client.post(
url,
data=json.dumps(test_data),
content_type="application/json"
)
print(f"Status Code: {response.status_code}")
print(f"Response: {response.content.decode()}")
if __name__ == "__main__":
test_subscription_creation()