| 285 | self.assertEqual(auth.token_type, "Basic") |
| 286 | |
| 287 | def testNetrcAuthFails(self): |
| 288 | # provide an empty netrc file to make sure this test does not find one |
| 289 | with NamedTemporaryFile("wt", delete=False) as tmp: |
| 290 | tmp.close() |
| 291 | auth = github.Auth.NetrcAuth() |
| 292 | with mock.patch.dict(os.environ, {"NETRC": tmp.name}): |
| 293 | with self.assertRaises(RuntimeError) as exc: |
| 294 | github.Github(auth=auth) |
| 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) |