Skip to content

Commit 7f67bd9

Browse files
committed
Fix: Guest Issuer tests
- Check for required environment variables. - Don't call decode on an str instance.
1 parent 60e3c6f commit 7f67bd9

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

tests/api/test_guest_issuer.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,16 @@
3434
"WEBEX_TEAMS_GUEST_ISSUER_SECRET"
3535
)
3636

37+
if not WEBEX_TEAMS_GUEST_ISSUER_ID:
38+
raise ValueError(
39+
"The WEBEX_TEAMS_GUEST_ISSUER_ID environment variable must be set."
40+
)
41+
42+
if not WEBEX_TEAMS_GUEST_ISSUER_SECRET:
43+
raise ValueError(
44+
"The WEBEX_TEAMS_GUEST_ISSUER_SECRET environment variable must be set."
45+
)
46+
3747

3848
# Helper Functions
3949

@@ -56,4 +66,5 @@ def test_get_guest_issuer_token(api):
5666
exp=str(int(time.time()) + TOKEN_EXPIRATION_SECONDS),
5767
secret=WEBEX_TEAMS_GUEST_ISSUER_SECRET,
5868
)
69+
5970
assert is_valid_guest_issuer_token(guest_issuer_token)

webexteamssdk/api/guest_issuer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def create(self, sub, name, iss, exp, secret):
115115
key = base64.b64decode(secret)
116116
jwt_token = jwt.encode(payload, key, algorithm="HS256")
117117

118-
headers = {"Authorization": "Bearer " + jwt_token.decode("utf-8")}
118+
headers = {"Authorization": "Bearer " + jwt_token}
119119

120120
json_data = self._session.post(
121121
API_ENDPOINT + "/" + "login", headers=headers

0 commit comments

Comments
 (0)