Commit 405c2d4e by Uman Shahzad Committed by Uman Shahzad

Update mocks/docs/code to reflect Enterprise API updates.

parent 21b823ab
...@@ -110,11 +110,14 @@ def fetch_enterprise_learner_data(site, user): ...@@ -110,11 +110,14 @@ def fetch_enterprise_learner_data(site, user):
"is_active": true, "is_active": true,
"date_joined": "2016-09-01T19:18:26.026495Z" "date_joined": "2016-09-01T19:18:26.026495Z"
}, },
"data_sharing_consent": [ "data_sharing_consent_records": [
{ {
"user": 1, "username": "staff",
"state": "enabled", "enterprise_customer_uuid": "cf246b88-d5f6-4908-a522-fc307e0b0c59",
"enabled": true "exists": true,
"consent_provided": true,
"consent_required": false,
"course_id": "course-v1:edX DemoX Demo_Course",
} }
] ]
} }
......
...@@ -172,11 +172,14 @@ class EnterpriseServiceMockMixin(object): ...@@ -172,11 +172,14 @@ class EnterpriseServiceMockMixin(object):
'is_active': True, 'is_active': True,
'date_joined': '2016-09-01T19:18:26.026495Z' 'date_joined': '2016-09-01T19:18:26.026495Z'
}, },
'data_sharing_consent': [ 'data_sharing_consent_records': [
{ {
'user': 1, "username": "verified",
'state': 'enabled' if consent_provided else 'disabled', "enterprise_customer_uuid": enterprise_customer_uuid,
'enabled': consent_provided "exists": True,
"consent_provided": consent_provided,
"consent_required": consent_enabled and not consent_provided,
"course_id": "course-v1:edX DemoX Demo_Course",
} }
] ]
} }
......
...@@ -271,10 +271,14 @@ def get_enterprise_course_consent_url( ...@@ -271,10 +271,14 @@ def get_enterprise_course_consent_url(
) )
request_params = { request_params = {
'course_id': course_id, 'course_id': course_id,
'enterprise_id': enterprise_customer_uuid, 'enterprise_customer_uuid': enterprise_customer_uuid,
'enrollment_deferred': True, 'defer_creation': True,
'next': callback_url, 'next': callback_url,
'failure_url': failure_url, 'failure_url': failure_url,
# TODO: Erase these 2 keys when edx-platform/ecommerce are both deployed to be using
# 'enterprise_customer_uuid' and 'defer_creation' rather than these.
'enterprise_id': enterprise_customer_uuid,
'enrollment_deferred': True,
} }
redirect_url = '{base}?{params}'.format( redirect_url = '{base}?{params}'.format(
base=site.siteconfiguration.enterprise_grant_data_sharing_url, base=site.siteconfiguration.enterprise_grant_data_sharing_url,
...@@ -290,9 +294,9 @@ def get_enterprise_customer_data_sharing_consent_token(access_token, course_id, ...@@ -290,9 +294,9 @@ def get_enterprise_customer_data_sharing_consent_token(access_token, course_id,
""" """
consent_token_hmac = hmac.new( consent_token_hmac = hmac.new(
str(access_token), str(access_token),
'{course_id}_{enterprise_uuid}'.format( '{course_id}_{enterprise_customer_uuid}'.format(
course_id=course_id, course_id=course_id,
enterprise_uuid=enterprise_customer_uuid, enterprise_customer_uuid=enterprise_customer_uuid,
), ),
digestmod=hashlib.sha256, digestmod=hashlib.sha256,
) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment