'Dry method for updating enrollment.'

def assert_update_enrollment(self, mode, is_active=True, include_expired=False):

    result = api.update_enrollment(self.USERNAME, self.COURSE_ID, mode=mode, is_active=is_active, include_expired=include_expired)
    self.assertEquals(mode, result['mode'])
    self.assertIsNotNone(result)
    self.assertEquals(result['student'], self.USERNAME)
    self.assertEquals(result['course']['course_id'], self.COURSE_ID)
    self.assertEquals(result['mode'], mode)
    if is_active:
        self.assertTrue(result['is_active'])
    else:
        self.assertFalse(result['is_active'])
