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

Method testRecreation

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

Source from the content-addressed store, hash-verified

54 super().tearDown()
55
56 def testRecreation(self):
57 class TestAuth(github.Auth.AppAuth):
58 pass
59
60 # create a Requester with non-default arguments
61 auth = TestAuth(123, "key")
62 requester = github.Requester.Requester(
63 auth=auth,
64 base_url="https://base.url",
65 timeout=1,
66 user_agent="user agent",
67 per_page=123,
68 verify=False,
69 retry=3,
70 pool_size=5,
71 seconds_between_requests=1.2,
72 seconds_between_writes=3.4,
73 # v3: this should not be the default value, so if this has been changed in v3,
74 # change it here is well
75 lazy=True,
76 )
77 kwargs = requester.kwargs
78
79 # assert kwargs consists of ALL constructor arguments
80 self.assertEqual(kwargs.keys(), github.Requester.Requester.__init__.__annotations__.keys())
81 self.assertEqual(
82 kwargs,
83 dict(
84 auth=auth,
85 base_url="https://base.url",
86 timeout=1,
87 user_agent="user agent",
88 per_page=123,
89 verify=False,
90 retry=3,
91 pool_size=5,
92 seconds_between_requests=1.2,
93 seconds_between_writes=3.4,
94 lazy=True,
95 ),
96 )
97
98 # create a copy Requester, assert identity via kwargs
99 copy = github.Requester.Requester(**kwargs)
100 self.assertEqual(copy.kwargs, kwargs)
101
102 # create Github instance, assert identity requester
103 gh = github.Github(**kwargs)
104 self.assertEqual(gh._Github__requester.kwargs, kwargs)
105
106 # create GithubIntegration instance, assert identity requester
107 gi = github.GithubIntegration(**kwargs)
108 self.assertEqual(gi._GithubIntegration__requester.kwargs, kwargs)
109
110 def testWithAuth(self):
111 class TestAuth(github.Auth.AppAuth):

Callers

nothing calls this directly

Calls 1

TestAuthClass · 0.85

Tested by

no test coverage detected