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

Method testCreateJWT

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

Source from the content-addressed store, hash-verified

295 self.assertEqual(exc.exception.args, ("Could not get credentials from netrc for host api.github.com",))
296
297 def testCreateJWT(self):
298 auth = github.Auth.AppAuth(APP_ID, PRIVATE_KEY)
299
300 with mock.patch("github.Auth.time") as t:
301 t.time = mock.Mock(return_value=1550055331.7435968)
302 token = auth.create_jwt()
303
304 payload = jwt.decode(
305 token,
306 key=PUBLIC_KEY,
307 algorithms=["RS256"],
308 options={"verify_exp": False},
309 issuer=str(APP_ID),
310 )
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)

Callers

nothing calls this directly

Calls 2

create_jwtMethod · 0.95
patchMethod · 0.80

Tested by

no test coverage detected