MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / create_request_cb

Method create_request_cb

test/test_auth_oidc.py:135–160  ·  view source on GitHub ↗
(self, username="test_user1", sleep=0)

Source from the content-addressed store, hash-verified

133 super().setUp()
134
135 def create_request_cb(self, username="test_user1", sleep=0):
136 def request_token(context: OIDCCallbackContext):
137 # Validate the info.
138 self.assertIsInstance(context.idp_info.issuer, str)
139 if context.idp_info.clientId is not None:
140 self.assertIsInstance(context.idp_info.clientId, str)
141
142 # Validate the timeout.
143 timeout_seconds = context.timeout_seconds
144 self.assertEqual(timeout_seconds, 60 * 5)
145
146 if context.refresh_token:
147 self.refresh_present += 1
148
149 token = self.get_token(username)
150 resp = OIDCCallbackResult(access_token=token, refresh_token=token)
151
152 time.sleep(sleep)
153 self.request_called += 1
154 return resp
155
156 class Inner(OIDCCallback):
157 def fetch(self, context):
158 return request_token(context)
159
160 return Inner()
161
162 def create_client(self, *args, **kwargs):
163 username = kwargs.get("username", "test_user1")

Calls 1

InnerClass · 0.70

Tested by

no test coverage detected