Skip to content

Commit 543cdac

Browse files
committed
fix test files
1 parent 3aaa280 commit 543cdac

File tree

4 files changed

+15
-12
lines changed

4 files changed

+15
-12
lines changed

livekit-api/tests/test_access_token.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
TEST_API_SECRET = "thiskeyistotallyunsafe"
1010

1111

12-
def test_verify_token():
12+
def test_verify_token() -> None:
1313
grants = VideoGrants(room_join=True, room="test_room")
1414
sip = SIPGrants(admin=True)
1515

@@ -30,11 +30,12 @@ def test_verify_token():
3030
assert claims.metadata == "test_metadata"
3131
assert claims.video == grants
3232
assert claims.sip == sip
33+
assert claims.attributes is not None
3334
assert claims.attributes["key1"] == "value1"
3435
assert claims.attributes["key2"] == "value2"
3536

3637

37-
def test_agent_config():
38+
def test_agent_config() -> None:
3839
token = (
3940
AccessToken(TEST_API_KEY, TEST_API_SECRET)
4041
.with_identity("test_identity")
@@ -50,6 +51,7 @@ def test_agent_config():
5051
token_verifier = TokenVerifier(TEST_API_KEY, TEST_API_SECRET)
5152
claims = token_verifier.verify(token)
5253
# Verify the decoded claims match
54+
assert claims.room_config is not None
5355
assert claims.room_config.agents[0].agent_name == "test-agent"
5456

5557
# Split token into header.payload.signature
@@ -74,7 +76,7 @@ def test_agent_config():
7476
assert payload_json["roomConfig"]["agents"][0]["agentName"] == "test-agent"
7577

7678

77-
def test_verify_token_invalid():
79+
def test_verify_token_invalid() -> None:
7880
token = AccessToken(TEST_API_KEY, TEST_API_SECRET).with_identity("test_identity").to_jwt()
7981

8082
token_verifier = TokenVerifier(TEST_API_KEY, "invalid_secret")
@@ -86,7 +88,7 @@ def test_verify_token_invalid():
8688
token_verifier.verify(token)
8789

8890

89-
def test_verify_token_expired():
91+
def test_verify_token_expired() -> None:
9092
token = (
9193
AccessToken(TEST_API_KEY, TEST_API_SECRET)
9294
.with_identity("test_identity")

livekit-api/tests/test_webhook.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"""
4646

4747

48-
def test_webhook_receiver():
48+
def test_webhook_receiver() -> None:
4949
token_verifier = TokenVerifier(TEST_API_KEY, TEST_API_SECRET)
5050
receiver = WebhookReceiver(token_verifier)
5151

@@ -56,7 +56,7 @@ def test_webhook_receiver():
5656
receiver.receive(TEST_EVENT, jwt)
5757

5858

59-
def test_bad_hash():
59+
def test_bad_hash() -> None:
6060
token_verifier = TokenVerifier(TEST_API_KEY, TEST_API_SECRET)
6161
receiver = WebhookReceiver(token_verifier)
6262

@@ -68,7 +68,7 @@ def test_bad_hash():
6868
receiver.receive(TEST_EVENT, jwt)
6969

7070

71-
def test_invalid_body():
71+
def test_invalid_body() -> None:
7272
token_verifier = TokenVerifier(TEST_API_KEY, TEST_API_SECRET)
7373
receiver = WebhookReceiver(token_verifier)
7474

livekit-rtc/tests/test_apm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from livekit.rtc import AudioProcessingModule, AudioFrame
66

77

8-
def test_audio_processing():
8+
def test_audio_processing() -> None:
99
sample_rate = 48000
1010
num_channels = 1
1111
frames_per_chunk = sample_rate // 100

livekit-rtc/tests/test_resampler.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
from livekit.rtc import AudioResampler, AudioResamplerQuality
1+
from livekit.rtc import AudioResampler, AudioResamplerQuality, AudioFrame
22
import time
33
import wave
44
import os
5+
from typing import List
56

67

7-
def test_audio_resampler():
8+
def test_audio_resampler() -> None:
89
current_dir = os.path.dirname(os.path.abspath(__file__))
910
wav_file_path = os.path.join(current_dir, "test_audio.wav")
1011

@@ -27,9 +28,9 @@ def test_audio_resampler():
2728
]
2829

2930
for quality in qualities:
30-
total_time = 0
31+
total_time = 0.0
3132
nb_runs = 20
32-
output_frames = []
33+
output_frames: List[AudioFrame] = []
3334
for i in range(nb_runs):
3435
output_frames = []
3536
resampler = AudioResampler(44100, 8000, quality=quality)

0 commit comments

Comments
 (0)