def test_existing_token_is_valid(self):
"""
On a second call in the same session, if the token isn't expired we shouldn't need to do another OAuth2 call.
"""
responses.add(
responses.POST,
self.oauth_url,
json=self.expected_token_response_body,
status=200
)
responses.add(
responses.DELETE,
self.course_url,
json='{}',
status=200
)
payload = {
'orgCode': 'org-code',
'providerCode': 'provider-code',
'courses': [{
'contentId': 'content-id',
}],
}
degreed_api_client = DegreedAPIClient(self.enterprise_config)
output1 = degreed_api_client.delete_course_content(payload)
output2 = degreed_api_client.delete_course_content(payload)
assert output1 == output2 == (200, '"{}"')
assert len(responses.calls) == 3
assert responses.calls[0].request.url == self.oauth_url
assert responses.calls[1].request.url == self.course_url
assert responses.calls[2].request.url == self.course_url
评论列表
文章目录