-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_record_format.py
More file actions
47 lines (38 loc) · 1.44 KB
/
test_record_format.py
File metadata and controls
47 lines (38 loc) · 1.44 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 python3
"""Test the exact record format being sent to API"""
import json
from utils.category_mapper import get_category_id_from_name, get_language_enum
from utils.api_client import APIClient
from config import API_BASE_URL
def test_record_format():
"""Test the exact record format"""
# Test category mapping
print("Testing category mapping...")
category_id = get_category_id_from_name("Fables")
print(f"Category ID for 'Fables': {category_id}")
# Test language mapping
print("\nTesting language mapping...")
language = get_language_enum("Hindi")
print(f"Language enum for 'Hindi': {language}")
# Create test record data
print("\nTest record format:")
test_record = {
"title": "Test Text Contribution",
"description": "This is a test text content for debugging API format",
"category_id": category_id,
"user_id": "12345678-1234-1234-1234-123456789012", # Dummy UUID
"media_type": "text",
"language": language,
"release_rights": "creator"
}
print(json.dumps(test_record, indent=2))
# Test with location
print("\nTest record with location:")
test_record_with_location = test_record.copy()
test_record_with_location["location"] = {
"latitude": 17.385,
"longitude": 78.4867
}
print(json.dumps(test_record_with_location, indent=2))
if __name__ == "__main__":
test_record_format()