# -*- coding: utf-8 -*-
import unittest
import os

from globocomtrends.spiders import parser
from tests import fake_response_from_file


class ParserTests(unittest.TestCase):

    def setUp(self):
        self.maxDiff = None
        self.current_dir = os.getcwd()

    def test_should_parser_item_from_response(self):
        item = parser.parse_item(
                fake_response_from_file('resources/comments.html')
        )
        self.assertIn('title', item)
        self.assertIn('comments_count', item)
        self.assertEqual(item['comments_count'], 643)


if __name__ == '__main__':
    unittest.main()

@@ -44,16 +44,75 @@
 ort os%0A%0A
+from globocomtrends.spiders.globocom import GlobocomSpider%0A
 from glo
@@ -145,16 +145,16 @@
  parser%0A
-
 from tes
@@ -315,16 +315,55 @@
 getcwd()
+%0A        self.spider = GlobocomSpider()
 %0A%0A    de
@@ -401,32 +401,32 @@
 response(self):%0A
-
         item = p
@@ -658,16 +658,329 @@
 , 643)%0A%0A
+    def test_should_spider_parse_item_from_response(self):%0A        item = self.spider.parse_item(%0A                fake_response_from_file('resources/comments.html')%0A        )%0A        self.assertIn('title', item)%0A        self.assertIn('comments_count', item)%0A        self.assertEqual(item%5B'comments_count'%5D, 643)%0A%0A
 %0Aif __na

test parser in spider