'Test that on the learner profile page user roles are correctly listed according to the course.'

def test_learner_profile_roles(self):

    expected_student_roles = ['Administrator', 'Community    TA', 'Moderator', 'Student']
    self.profiled_user_id = self.setup_user(roles=expected_student_roles, username=self.PROFILED_USERNAME)
    page = DiscussionUserProfilePage(self.browser, self.course_id, self.profiled_user_id, self.PROFILED_USERNAME)
    page.visit()
    student_roles = page.get_user_roles()
    self.assertEqual(student_roles, ',    '.join(expected_student_roles))
    old_course_id = self.course_id
    self.course_info['number'] = self.unique_id
    self.setup_course()
    new_course_id = self.course_id
    profiled_student_user_id = self.setup_user(roles=None, username=self.PROFILED_USERNAME)
    self.assertEqual(self.profiled_user_id, profiled_student_user_id)
    self.assertNotEqual(old_course_id, new_course_id)
    page = DiscussionUserProfilePage(self.browser, self.course_id, self.profiled_user_id, self.PROFILED_USERNAME)
    page.visit()
    self.assertEqual(page.get_user_roles(), u'Student')
