MCPcopy Index your code
hub / github.com/PyGithub/PyGithub / testCreateJWTWithExpiration

Method testCreateJWTWithExpiration

tests/Authentication.py:313–327  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

311 self.assertDictEqual(payload, {"iat": 1550055271, "exp": 1550055631, "iss": str(APP_ID)})
312
313 def testCreateJWTWithExpiration(self):
314 auth = github.Auth.AppAuth(APP_ID, PRIVATE_KEY, jwt_expiry=120, jwt_issued_at=-30)
315
316 with mock.patch("github.Auth.time") as t:
317 t.time = mock.Mock(return_value=1550055331.7435968)
318 token = auth.create_jwt(60)
319
320 payload = jwt.decode(
321 token,
322 key=PUBLIC_KEY,
323 algorithms=["RS256"],
324 options={"verify_exp": False},
325 issuer=str(APP_ID),
326 )
327 self.assertDictEqual(payload, {"iat": 1550055301, "exp": 1550055391, "iss": str(APP_ID)})
328
329 def testUserAgent(self):
330 g = github.Github(user_agent="PyGithubTester")

Callers

nothing calls this directly

Calls 2

create_jwtMethod · 0.95
patchMethod · 0.80

Tested by

no test coverage detected