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

Method test_get_github_user_token

app/git/tests/test_utils.py:112–130  ·  view source on GitHub ↗

Test the github utility get_github_user_token method.

(self)

Source from the content-addressed store, hash-verified

110
111 @responses.activate
112 def test_get_github_user_token(self):
113 """Test the github utility get_github_user_token method."""
114 data = {'access_token': self.user_oauth_token, 'scope': 'read:user,user:email'}
115 params = {
116 'code': self.callback_code,
117 'client_id': settings.GITHUB_CLIENT_ID,
118 'client_secret': settings.GITHUB_CLIENT_SECRET,
119 }
120 params = urlencode(params, quote_via=quote_plus)
121 url = settings.GITHUB_TOKEN_URL + '?' + params
122 responses.add(responses.GET, settings.GITHUB_TOKEN_URL, json=data, headers=JSON_HEADER, status=200)
123 responses.add(responses.GET, settings.GITHUB_TOKEN_URL, json={}, headers=JSON_HEADER, status=200)
124 result = get_github_user_token(self.callback_code)
125 result_no_token = get_github_user_token(self.callback_code)
126
127 assert responses.calls[0].request.url == url
128 assert responses.calls[1].request.url == url
129 assert result == self.user_oauth_token
130 assert result_no_token is None
131
132 @responses.activate
133 def test_get_github_user_data(self):

Callers

nothing calls this directly

Calls 2

get_github_user_tokenFunction · 0.90
addMethod · 0.80

Tested by

no test coverage detected