def test_load_url(self, mock_get): p = Producer() url = 'http://ajankovic.com/blog/' markup = p.load_url(url) self.assertEqual(url, markup[0]) self.assertEqual(BLOG_RESPONSE, markup[1]) self.assertIn(mock.call(url, timeout=30), mock_get.call_args_list)
def test_run(self, mock_get): p = Producer() q = Queue() websites = ['http://ajankovic.com/blog/', 'http://test.com'] extracted = [BLOG_RESPONSE, TEST_RESPONSE] p.run(websites, q) for item in drain(q): if item is None: break self.assertIn(item[1], extracted)