'Make sure that ajax request works correctly'

def test_good_ajax_request(self):

    post_data = MultiDict((('student_words[]', word) for word in ['cat', 'cat', 'dog', 'sun']))
    response = self.ajax_request('submit', post_data)
    self.assertEqual(response['status'], 'success')
    self.assertEqual(response['submitted'], True)
    self.assertEqual(response['total_count'], 22)
    self.assertDictEqual(response['student_words'], {'sun': 1, 'dog': 6, 'cat': 12})
    self.assertListEqual(response['top_words'], [{'text': 'dad', 'size': 2, 'percent': 9.0}, {'text': 'sun', 'size': 1, 'percent': 5.0}, {'text': 'dog', 'size': 6, 'percent': 27.0}, {'text': 'mom', 'size': 1, 'percent': 5.0}, {'text': 'cat', 'size': 12, 'percent': 54.0}])
    self.assertEqual(100.0, sum((i['percent'] for i in response['top_words'])))
