(self, username="test_user1", sleep=0)
| 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") |
no test coverage detected