'Test that XSS attack is prevented'

@ddt.data('"><script>alert(1)</script>', '<script>alert(1)</script>', '</script><script>alert(1)</script>')
@patch('student.models.cc.User.from_django_user')
@patch('student.models.cc.User.active_threads')
def test_forum_user_profile_xss_prevent(self, malicious_code, mock_threads, mock_from_django_user, mock_request):

    mock_threads.return_value = ([], 1, 1)
    mock_from_django_user.return_value.to_dict.return_value = {}
    mock_request.side_effect = make_mock_request_impl(course=self.course, text='dummy')
    url = reverse('discussion.views.user_profile', kwargs={'course_id': unicode(self.course.id), 'user_id': str(self.student.id)})
    url_string = ('%s?%s=%s' % (url, 'page', malicious_code))
    resp = self.client.get(url_string)
    self.assertEqual(resp.status_code, 200)
    self.assertNotIn(malicious_code, resp.content)
