def test_create_webclient(self): mockweb = MockWebClient(HTMLFactory.tablamensajes_html()) self.factory = AsuntoFactory(mockweb) res = self.factory.createListOfAsuntos() self.assertEquals(2, len(res)) self.assertEqual(res[0]['title'], u'1936 guerra civil - D6') self.assertEqual(res[1]['title'], u'Temporada de Regionales 2014 de Edge')
def test_createThreadStruct(self): mockweb = MockWebClient(HTMLFactory.tablamensajes_html()) self.threadfactory = AsuntoFactory(mockweb) self.assertEquals("", self.threadfactory.nextUrl()) thread = self.threadfactory.create(HTMLFactory.asunto()) msgs = list() struct = ThreadModel(self. processthread._createThreadStruct(thread, msgs)) self.assertEquals("LaBSK", struct.source()) self.assertEquals(thread['title'], struct.title()) self.assertEquals(struct.answers(), 0) self.assertIsInstance(struct.json()['msgs'], list)
def test_next_url_is_empty_when_not_next_URL(self): mockweb = MockWebClient(HTMLFactory.tablamensajes_html()) self.factory = AsuntoFactory(mockweb) self.assertEqual(self.factory.nextUrl(), "")
def setUp(self): mockweb = MockWebClient(HTMLFactory.tablamensajes_html()) self.threadfactory = AsuntoFactory(mockweb) self.mongo = MockMongo() self.processthread = ProcessThreads(self.mongo, MockMsgPageFactory()) self.navhtml = HTMLFactory.tablamensajes_html() + HTMLFactory.navigation_url()