'Test update forum role membership.
Get unique_student_identifier, rolename and action and update forum role.'

def assert_update_forum_role_membership(self, current_user, identifier, rolename, action):

    url = reverse('update_forum_role_membership', kwargs={'course_id': self.course.id.to_deprecated_string()})
    response = self.client.post(url, {'unique_student_identifier': identifier, 'rolename': rolename, 'action': action})
    self.assertEqual(response.status_code, 200)
    user_roles = current_user.roles.filter(course_id=self.course.id).values_list('name', flat=True)
    if (action == 'allow'):
        self.assertIn(rolename, user_roles)
    elif (action == 'revoke'):
        self.assertNotIn(rolename, user_roles)
