def test_crawler_tasks_generation(self, list_boards): # We only use the id field in order to generate tasks list_boards.return_value = [{'id': 'test'}] logger = mock.Mock() token = mock.Mock() push_api = mock.Mock() crawler = TrelloCrawler(ComponentManager()) # Full Crawl tasks = crawler.iter_crawl_tasks(push_api, token, logger, full=True) self.assertIn('tasks', tasks) # A task to retrieve cards the other one members self.assertEqual(2, len(tasks['tasks'])) # Incremental Crawl tasks_and_epilogue = crawler.iter_crawl_tasks(push_api, token, logger) self.assertIn('tasks', tasks_and_epilogue) # A task to retrieve cards the other one members self.assertEqual(2, len(tasks['tasks'])) self.assertIn('epilogue', tasks_and_epilogue) self.assertIsInstance( tasks_and_epilogue['epilogue'], types.FunctionType )
def test_crawler_service_name(self): crawler = TrelloCrawler(ComponentManager()) self.assertEqual(crawler.get_service_name(), 'trello')