MCPcopy
hub / github.com/gitcoinco/web / test_is_github_token_valid

Method test_is_github_token_valid

app/git/tests/test_utils.py:153–167  ·  view source on GitHub ↗

Test the github utility is_github_token_valid method.

(self)

Source from the content-addressed store, hash-verified

151
152 @responses.activate
153 def test_is_github_token_valid(self):
154 """Test the github utility is_github_token_valid method."""
155 now = timezone.now()
156 expired = (now - timedelta(hours=2)).isoformat()
157 return_false = is_github_token_valid()
158 return_valid = is_github_token_valid(self.user_oauth_token, now.isoformat())
159 params = build_auth_dict(self.user_oauth_token)
160 url = TOKEN_URL.format(**params)
161 responses.add(responses.GET, url, headers=HEADERS, status=200)
162 return_expired = is_github_token_valid(self.user_oauth_token, expired)
163
164 assert responses.calls[0].request.url == url
165 assert return_false is False
166 assert return_valid is True
167 assert return_expired is True
168
169 @responses.activate
170 def test_get_github_primary_email(self):

Callers

nothing calls this directly

Calls 4

is_github_token_validFunction · 0.90
build_auth_dictFunction · 0.90
nowMethod · 0.80
addMethod · 0.80

Tested by

no test coverage detected