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

Method testGetGithubForInstallation

tests/Installation.py:95–134  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

93 self.assertListEqual([repo.full_name for repo in repos], ["EnricoMi/sandbox", "EnricoMi/python"])
94
95 def testGetGithubForInstallation(self):
96 # with verify=False, urllib3.connectionpool rightly may issue an InsecureRequestWarning
97 # we ignore InsecureRequestWarning from urllib3.connectionpool
98 with self.ignoreWarning(category=InsecureRequestWarning, module="urllib3.connectionpool"):
99 kwargs = dict(
100 auth=AppAuth(319953, GithubIntegration.PRIVATE_KEY),
101 # http protocol used to deviate from default base url, recording data might require https
102 base_url="http://api.github.com",
103 timeout=Consts.DEFAULT_TIMEOUT + 10,
104 user_agent="PyGithub/Python-Test",
105 per_page=Consts.DEFAULT_PER_PAGE + 10,
106 verify=False,
107 retry=3,
108 pool_size=10,
109 seconds_between_requests=100,
110 seconds_between_writes=1000,
111 # v3: this should not be the default value, so if this has been changed in v3,
112 # change it here is well
113 lazy=True,
114 )
115
116 # assert kwargs consists of ALL requester constructor arguments
117 self.assertEqual(kwargs.keys(), github.Requester.Requester.__init__.__annotations__.keys())
118
119 integration = github.GithubIntegration(**kwargs)
120 installations = list(integration.get_installations())
121 installation = installations[0]
122
123 g = installation.get_github_for_installation()
124
125 self.assertIsInstance(g._Github__requester.auth, AppInstallationAuth)
126
127 actual = g._Github__requester.kwargs
128 kwargs.update(auth=str(AppInstallationAuth))
129 actual.update(auth=str(type(actual["auth"])))
130 self.assertDictEqual(kwargs, actual)
131
132 repo = g.get_repo("PyGithub/PyGithub")
133 self.assertEqual(repo.id, 3544490)
134 self.assertEqual(repo.full_name, "PyGithub/PyGithub")
135
136 def testRequester(self):
137 self.assertEqual(len(self.installations), 1)

Callers

nothing calls this directly

Calls 6

get_installationsMethod · 0.95
AppAuthClass · 0.90
ignoreWarningMethod · 0.80
updateMethod · 0.45
get_repoMethod · 0.45

Tested by

no test coverage detected