コード例 #1
0
 def test_save_model(self):
     """ tests to see if the return type of save is a string """
     dog = FileStorage()
     dog.save()
     self.assertIsInstance(dog.to_dict()['created_at'], str)
     self.assertIsInstance(dog.to_dict()['updated_at'], str)
     self.assertNotEqual(old_updated, dog.updated_at)
     d = dog.to_dict()
     self.assertEqual(type(d), dict)
     self.assertEqual(d['__class__'], "BaseModel")
     self.assertEqual(d['created_at'], dog.created_at.isoformat())
     self.assertEqual(d['updated_at'], dog.updated_at.isoformat())
     self.assertEqual(d['id'], dog.id)
コード例 #2
0
 def to_dict(self):
     base = FileStorage()
     self.assertEqual(type(base.to_dict()), dict)