def test_from_file_csv(self): csv_file = "./fixtures/HeatherPiwowar_070814.csv" ImpactStory.from_file(csv_file) self.assertTrue("File type is not JSON")
def test_from_file_json(self): json_file = "./fixtures/HeatherPiwowar_070914.json" impact_story_obj = ImpactStory.from_file(json_file) self.assertIsInstance(impact_story_obj, ImpactStory)
def test_from_file_corrupted(self): corrupted_json = "./fixtures/Corrupted_JSON.json" with self.assertRaises(ImpactStoryParseException) as cm: ImpactStory.from_file(corrupted_json) exception = cm.exception self.failUnlessRaises(exception)
def setUp(self): self.heather = ImpactStory.from_id("Heather Piwowar") self.saman = ImpactStory.from_file("./fixtures/SamanEhsan_070814.json") self.brian = ImpactStory.from_id("Brian Nosek")