Skip to content

Commit 4e87b75

Browse files
committed
ruff
1 parent 231bb46 commit 4e87b75

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

livekit-api/tests/test_webhook.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import base64
22
import hashlib
3-
43
import pytest # type: ignore
54
from livekit.api import AccessToken, TokenVerifier, WebhookReceiver
65

7-
TEST_API_KEY = 'myapikey'
8-
TEST_API_SECRET = 'thiskeyistotallyunsafe'
6+
TEST_API_KEY = "myapikey"
7+
TEST_API_SECRET = "thiskeyistotallyunsafe"
98
TEST_EVENT = """
109
{
1110
"event": "room_started",
@@ -61,7 +60,7 @@ def test_bad_hash():
6160
receiver = WebhookReceiver(token_verifier)
6261

6362
token = AccessToken(TEST_API_KEY, TEST_API_SECRET)
64-
hash64 = base64.b64encode(hashlib.sha256('wrong_hash'.encode()).digest()).decode()
63+
hash64 = base64.b64encode(hashlib.sha256("wrong_hash".encode()).digest()).decode()
6564
token.claims.sha256 = hash64
6665
jwt = token.to_jwt()
6766
with pytest.raises(Exception): # Using a broad Exception for existing test
@@ -73,7 +72,7 @@ def test_invalid_body():
7372
receiver = WebhookReceiver(token_verifier)
7473

7574
token = AccessToken(TEST_API_KEY, TEST_API_SECRET)
76-
body = 'invalid body'
75+
body = "invalid body"
7776
hash64 = base64.b64encode(hashlib.sha256(body.encode()).digest()).decode()
7877
token.claims.sha256 = hash64
7978
jwt = token.to_jwt()
@@ -88,7 +87,7 @@ def test_malformed_jwt():
8887
token_verifier = TokenVerifier(TEST_API_KEY, TEST_API_SECRET)
8988
receiver = WebhookReceiver(token_verifier)
9089

91-
malformed_jwt = 'this.is.not.a.valid.jwt' # A clearly malformed string
90+
malformed_jwt = "this.is.not.a.valid.jwt" # A clearly malformed string
9291

9392
with pytest.raises(Exception):
94-
receiver.receive(TEST_EVENT, malformed_jwt)
93+
receiver.receive(TEST_EVENT, malformed_jwt)

0 commit comments

Comments
 (0)