def test_fetch_empty(self): """Test whether it does nothing when a response is empty""" setup_http_server() gmls = GmaneMailingList('*****@*****.**', self.tmp_path) archives = gmls.fetch(offset=6000) self.assertEqual(len(archives), 0) mboxes = gmls.mboxes self.assertEqual(len(mboxes), 0)
def test_fetch_from_offset(self): """Test whether it fetches a set of messages from a given offset""" setup_http_server() gmls = GmaneMailingList('*****@*****.**', self.tmp_path) archives = gmls.fetch(offset=4000) self.assertEqual(len(archives), 1) self.assertEqual(archives[0][0], 4000) self.assertEqual(archives[0][1], os.path.join(self.tmp_path, '4000')) mboxes = gmls.mboxes self.assertEqual(len(mboxes), 1) self.assertEqual(mboxes[0].filepath, os.path.join(self.tmp_path, '4000'))
def test_fetch(self): """Test whether it fetches a set of messages""" setup_http_server() gmls = GmaneMailingList('*****@*****.**', self.tmp_path) archives = gmls.fetch() self.assertEqual(len(archives), 3) self.assertEqual(archives[0][0], 0) self.assertEqual(archives[0][1], os.path.join(self.tmp_path, '0')) self.assertEqual(archives[1][0], 2000) self.assertEqual(archives[1][1], os.path.join(self.tmp_path, '2000')) self.assertEqual(archives[2][0], 4000) self.assertEqual(archives[2][1], os.path.join(self.tmp_path, '4000')) mboxes = gmls.mboxes self.assertEqual(len(mboxes), 3) self.assertEqual(mboxes[0].filepath, os.path.join(self.tmp_path, '0')) self.assertEqual(mboxes[1].filepath, os.path.join(self.tmp_path, '2000')) self.assertEqual(mboxes[2].filepath, os.path.join(self.tmp_path, '4000'))