LMS: Modification in enrollment API
Changed enrollment api to set enrollment atributes if the course is credit course ECOM-1719
This commit is contained in:
@@ -143,6 +143,29 @@ class EnrollmentTest(TestCase):
|
||||
result = api.update_enrollment(self.USERNAME, self.COURSE_ID, mode='verified')
|
||||
self.assertEquals('verified', result['mode'])
|
||||
|
||||
def test_update_enrollment_attributes(self):
|
||||
# Add fake course enrollment information to the fake data API
|
||||
fake_data_api.add_course(self.COURSE_ID, course_modes=['honor', 'verified', 'audit', 'credit'])
|
||||
# Enroll in the course and verify the URL we get sent to
|
||||
result = api.add_enrollment(self.USERNAME, self.COURSE_ID, mode='audit')
|
||||
get_result = api.get_enrollment(self.USERNAME, self.COURSE_ID)
|
||||
self.assertEquals(result, get_result)
|
||||
|
||||
enrollment_attributes = [
|
||||
{
|
||||
"namespace": "credit",
|
||||
"name": "provider_id",
|
||||
"value": "hogwarts",
|
||||
}
|
||||
]
|
||||
|
||||
result = api.update_enrollment(
|
||||
self.USERNAME, self.COURSE_ID, mode='credit', enrollment_attributes=enrollment_attributes
|
||||
)
|
||||
self.assertEquals('credit', result['mode'])
|
||||
attributes = api.get_enrollment_attributes(self.USERNAME, self.COURSE_ID)
|
||||
self.assertEquals(enrollment_attributes[0], attributes[0])
|
||||
|
||||
def test_get_course_details(self):
|
||||
# Add a fake course enrollment information to the fake data API
|
||||
fake_data_api.add_course(self.COURSE_ID, course_modes=['honor', 'verified', 'audit'])
|
||||
|
||||
Reference in New Issue
Block a user