def test_getpostList_Json(self): """ Testing that, when reading from a generated file, it is possible to get python-postpbjects from it. it is a little dumb, but you have to provide console input to run test """ newScrape = Scraping("BarackObama", 3) newScrape.scrape_data() payload = newScrape.get_posts() Organizer.create_project("BarackObama") Organizer.write_file_json(payload, "BarackObama") supposedpath = os.getcwd() + "/Jsondata_files/BarackObama" list , path = Organizer.getpostList_Json() self.assertIsInstance(list[0], tweet) self.assertEqual(path, supposedpath)
def test_create_project(self): """ Testing whether a path to a folder is generated since these tests are in another file, the generated file will appear in this directory """ Organizer.create_project(self.handle) supposedpath = os.getcwd() + "/Jsondata_files" folderpath = os.listdir(supposedpath) self.assertGreater(len(folderpath), 0)