(self)
| 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) |
nothing calls this directly
no test coverage detected