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

Method testWithAuth

tests/Requester.py:110–152  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

108 self.assertEqual(gi._GithubIntegration__requester.kwargs, kwargs)
109
110 def testWithAuth(self):
111 class TestAuth(github.Auth.AppAuth):
112 pass
113
114 # create a Requester with non-default arguments
115 auth = TestAuth(123, "key")
116 requester = github.Requester.Requester(
117 auth=auth,
118 base_url="https://base.url",
119 timeout=1,
120 user_agent="user agent",
121 per_page=123,
122 verify=False,
123 retry=3,
124 pool_size=5,
125 seconds_between_requests=1.2,
126 seconds_between_writes=3.4,
127 # v3: this should not be the default value, so if this has been changed in v3,
128 # change it here is well
129 lazy=True,
130 )
131
132 # create a copy with different auth
133 auth2 = TestAuth(456, "key2")
134 copy = requester.withAuth(auth2)
135
136 # assert kwargs of copy
137 self.assertEqual(
138 copy.kwargs,
139 dict(
140 auth=auth2,
141 base_url="https://base.url",
142 timeout=1,
143 user_agent="user agent",
144 per_page=123,
145 verify=False,
146 retry=3,
147 pool_size=5,
148 seconds_between_requests=1.2,
149 seconds_between_writes=3.4,
150 lazy=True,
151 ),
152 )
153
154 def testGetParametersOfUrl(self):
155 self.assertEqual({}, gr.Requester.get_parameters_of_url("https://github.com/api"))

Callers

nothing calls this directly

Calls 2

withAuthMethod · 0.95
TestAuthClass · 0.85

Tested by

no test coverage detected