Test the github utility is_github_token_valid method.
(self)
| 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): |
nothing calls this directly
no test coverage detected