Skip to content

Commit d429462

Browse files
committed
Add full video enrollment+verification CI test with test recordings
1 parent 18e10ec commit d429462

6 files changed

Lines changed: 37 additions & 23 deletions

File tree

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ jobs:
66
test:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v6
10-
- uses: actions/setup-python@v6
9+
- uses: actions/checkout@v4
10+
- uses: actions/setup-python@v5
1111
with:
1212
python-version: '3.12'
1313
- run: pip install requests
14-
- name: Run API test
14+
- name: Run full API test
1515
env:
1616
VOICEIT_API_KEY: ${{ secrets.VOICEIT_API_KEY }}
1717
VOICEIT_API_TOKEN: ${{ secrets.VOICEIT_API_TOKEN }}

test-data/videoEnrollmentA1.mov

403 KB
Binary file not shown.

test-data/videoEnrollmentA2.mov

3.91 MB
Binary file not shown.

test-data/videoEnrollmentA3.mov

3.86 MB
Binary file not shown.

test-data/videoVerificationA1.mov

4.46 MB
Binary file not shown.

test_example.py

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,42 @@
11
#!/usr/bin/env python3
2-
"""Test script for VoiceIt3 Python SDK — exercises all API endpoints against voiceitapi3"""
3-
4-
import os
5-
import sys
2+
"""Full API test: create user, video enroll x3, video verify, cleanup"""
3+
import os, sys
64
from voiceit3 import VoiceIt3
75

86
api_key = os.environ.get("VOICEIT_API_KEY", "")
97
api_token = os.environ.get("VOICEIT_API_TOKEN", "")
10-
118
if not api_key or not api_token:
12-
print("Set VOICEIT_API_KEY and VOICEIT_API_TOKEN environment variables")
13-
sys.exit(1)
9+
print("Set VOICEIT_API_KEY and VOICEIT_API_TOKEN"); sys.exit(1)
1410

1511
vi = VoiceIt3(api_key, api_token)
16-
17-
# Users
18-
print("CreateUser:", vi.create_user())
19-
print("GetAllUsers:", vi.get_all_users())
20-
21-
# Groups
22-
print("CreateGroup:", vi.create_group("Test Group"))
23-
print("GetAllGroups:", vi.get_all_groups())
24-
25-
# Phrases
26-
print("GetPhrases:", vi.get_phrases("en-US"))
27-
28-
print("\nAll API calls completed successfully!")
12+
phrase = "never forget tomorrow is a new day"
13+
td = "test-data"
14+
errors = 0
15+
16+
def check(step, r, expected="SUCC"):
17+
global errors
18+
code = r.get("responseCode", "?")
19+
ok = code == expected
20+
print(f"{'PASS' if ok else 'FAIL'}: {step} ({code})")
21+
if not ok: errors += 1
22+
return r
23+
24+
# 1. Create user
25+
r = check("CreateUser", vi.create_user())
26+
user_id = r.get("userId", "")
27+
28+
# 2. Video enrollment x3
29+
for i in range(1, 4):
30+
check(f"VideoEnrollment{i}", vi.create_video_enrollment(user_id, "en-US", phrase, f"{td}/videoEnrollmentA{i}.mov"))
31+
32+
# 3. Video verification (tests both voice + face)
33+
r = check("VideoVerification", vi.video_verification(user_id, "en-US", phrase, f"{td}/videoVerificationA1.mov"))
34+
print(f" Voice confidence: {r.get('voiceConfidence', 0)}, Face confidence: {r.get('faceConfidence', 0)}")
35+
36+
# 4. Cleanup
37+
check("DeleteEnrollments", vi.delete_all_enrollments(user_id))
38+
check("DeleteUser", vi.delete_user(user_id))
39+
40+
if errors > 0:
41+
print(f"\n{errors} FAILURES"); sys.exit(1)
42+
print("\nAll tests passed!")

0 commit comments

Comments
 (0)