'Toggle masquerade state.'

def update_masquerade(self, role, group_id=None, user_name=None):

    masquerade_url = reverse('masquerade_update', kwargs={'course_key_string': unicode(self.course.id)})
    response = self.client.post(masquerade_url, json.dumps({'role': role, 'group_id': group_id, 'user_name': user_name}), 'application/json')
    self.assertEqual(response.status_code, 200)
    return response
