def test_to_json(self): overall_pos = OverallPos() overall_pos.save_raw_data(date=test_date, raw_overall=test_raw_overall) json_data = overall_pos.to_json() print json_data
def save_overall(self): """ save overall data into db only one overall in one day """ overall_pos = OverallPos() overall_pos.save_raw_data(date=self.date, raw_overall=self.overall) return overall_pos.id
def test_save_raw_data(self): overall_pos = OverallPos() overall_pos.save_raw_data(date=test_date, raw_overall=test_raw_overall) print 'Inserted IDs: %s' % overall_pos.id print 'option row count in db: %d\n' % len(OverallPos.objects.all()) print 'Overall Data:' print overall_pos self.assertTrue(overall_pos.id) self.assertEqual(len(OverallPos.objects.all()), 1)