-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
60 lines (52 loc) · 1.39 KB
/
test.py
File metadata and controls
60 lines (52 loc) · 1.39 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
#!/usr/bin/env python3
"""
test.py
Simple smoke tests for your Python Lambda scene‐based frame extractor.
Make sure you’ve set your .env (or real env vars) before running:
export $(grep -v '^#' .env | xargs)
Usage:
python3 test.py
"""
import os
import json
from lambda_function import lambda_handler
def test_bulk_extraction():
# List of known shortcodes for bulk test
codes = [
"DE2sdOOOx_R",
"DE2tzvUyook",
"DE4Td6OSRQV",
"DE4VHQovJy1",
"DE4Y8DgJFFV",
]
records = [
{
"body": json.dumps({
"code": code,
"platform": "instagram"
})
}
for code in codes
]
event = {"Records": records}
print("Running bulk extraction test...")
result = lambda_handler(event, None)
print(json.dumps(result, indent=2))
def test_single_extraction():
# Single‐video test
record = {
"body": json.dumps({
"code": "DIB0wE1SHVa",
"platform": "instagram"
})
}
event = {"Records": [record]}
print("Running single extraction test...")
result = lambda_handler(event, None)
print(json.dumps(result, indent=2))
if __name__ == "__main__":
# Clear any temp dirs from previous runs
os.environ.setdefault("DEBUG", "true")
test_bulk_extraction()
print("\n" + "="*60 + "\n")
test_single_extraction()