Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
a28f54bf
Commit
a28f54bf
authored
3 years ago
by
Albert (AJ) St. Aubin
Browse files
Options
Downloads
Patches
Plain Diff
feat: Added lms_user_id and email to data sent to Credentials for Program certs
[MICROBA-1466]
parent
2fe08ce5
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
openedx/core/djangoapps/programs/tasks.py
+7
-5
7 additions, 5 deletions
openedx/core/djangoapps/programs/tasks.py
openedx/core/djangoapps/programs/tests/test_tasks.py
+6
-3
6 additions, 3 deletions
openedx/core/djangoapps/programs/tests/test_tasks.py
with
13 additions
and
8 deletions
openedx/core/djangoapps/programs/tasks.py
+
7
−
5
View file @
a28f54bf
...
...
@@ -91,15 +91,15 @@ def get_certified_programs(student):
return
certified_programs
def
award_program_certificate
(
client
,
user
name
,
program_uuid
,
visible_date
):
def
award_program_certificate
(
client
,
user
,
program_uuid
,
visible_date
):
"""
Issue a new certificate of completion to the given student for the given program.
Args:
client:
credentials API client (EdxRestApiClient)
user
name
:
The
username of the student
user:
The
student
'
s user data
program_uuid:
uuid of the completed program
visible_date:
...
...
@@ -110,7 +110,9 @@ def award_program_certificate(client, username, program_uuid, visible_date):
"""
client
.
credentials
.
post
({
'
username
'
:
username
,
'
username
'
:
user
.
username
,
'
lms_user_id
'
:
user
.
id
,
'
email
'
:
user
.
email
,
'
credential
'
:
{
'
type
'
:
PROGRAM_CERTIFICATE
,
'
program_uuid
'
:
program_uuid
...
...
@@ -231,7 +233,7 @@ def award_program_certificates(self, username): # lint-amnesty, pylint: disable
visible_date
=
completed_programs
[
program_uuid
]
try
:
LOGGER
.
info
(
f
"
Visible date for user
{
username
}
: program
{
program_uuid
}
is
{
visible_date
}
"
)
award_program_certificate
(
credentials_client
,
username
,
program_uuid
,
visible_date
)
award_program_certificate
(
credentials_client
,
student
,
program_uuid
,
visible_date
)
LOGGER
.
info
(
f
"
Awarded certificate for program
{
program_uuid
}
to user
{
username
}
"
)
except
exceptions
.
HttpNotFoundError
:
LOGGER
.
exception
(
...
...
This diff is collapsed.
Click to expand it.
openedx/core/djangoapps/programs/tests/test_tasks.py
+
6
−
3
View file @
a28f54bf
...
...
@@ -87,7 +87,8 @@ class AwardProgramCertificateTestCase(TestCase):
"""
Ensure the correct API call gets made
"""
test_username
=
'
test-username
'
student
=
UserFactory
(
username
=
'
test-username
'
,
email
=
'
test-email@email.com
'
)
test_client
=
EdxRestApiClient
(
'
http://test-server
'
,
jwt
=
'
test-token
'
)
httpretty
.
register_uri
(
...
...
@@ -95,10 +96,12 @@ class AwardProgramCertificateTestCase(TestCase):
'
http://test-server/credentials/
'
,
)
tasks
.
award_program_certificate
(
test_client
,
test_username
,
123
,
datetime
(
2010
,
5
,
30
))
tasks
.
award_program_certificate
(
test_client
,
student
,
123
,
datetime
(
2010
,
5
,
30
))
expected_body
=
{
'
username
'
:
test_username
,
'
username
'
:
student
.
username
,
'
lms_user_id
'
:
student
.
id
,
'
email
'
:
student
.
email
,
'
credential
'
:
{
'
program_uuid
'
:
123
,
'
type
'
:
tasks
.
PROGRAM_CERTIFICATE
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment