Merge pull request #18594 from edx/tasawer/learner-4467/fix-exception-handling-in-award-program-certificate-task
Fix exception handling in award program certificate task
This commit is contained in:
@@ -173,7 +173,7 @@ def award_program_certificates(self, username):
|
||||
try:
|
||||
award_program_certificate(credentials_client, username, program_uuid)
|
||||
LOGGER.info('Awarded certificate for program %s to user %s', program_uuid, username)
|
||||
except exceptions.HttpNotFoundError:
|
||||
except exceptions.HttpClientError:
|
||||
LOGGER.exception(
|
||||
'Certificate for program %s not configured, unable to award certificate to %s',
|
||||
program_uuid, username
|
||||
|
||||
@@ -301,7 +301,7 @@ class AwardProgramCertificatesTestCase(CatalogIntegrationMixin, CredentialsApiCo
|
||||
mock_get_completed_programs.return_value = [1, 2]
|
||||
mock_get_certified_programs.side_effect = [[], [2]]
|
||||
mock_award_program_certificate.side_effect = self._make_side_effect(
|
||||
[exceptions.HttpNotFoundError(), None]
|
||||
[exceptions.HttpClientError(), None]
|
||||
)
|
||||
|
||||
tasks.award_program_certificates.delay(self.student.username).get()
|
||||
|
||||
Reference in New Issue
Block a user