示例#1
0
 def test_save(self):
     """check if it saves changes"""
     my_model = FileStorage()
     my_model.name = "Holberton"
     my_model.my_number = 89
     my_model.save()
     self.assertTrue(os.path.isfile('file.json'))
示例#2
0
 def test_PreData2(self):
     """ Test of the PreData """
     PreData6 = FileStorage()
     PreData6.name = "Jadon"
     PreData6.my_number = 7
     self.assertTrue(isinstance(PreData6, FileStorage))
     self.assertTrue(type(PreData6), object)
     self.assertEqual(str(type(FileStorage)), "<class 'type'>")
示例#3
0
 def test_FileStorage_1(self):
     """Tests the FileStorage again"""
     my_model = FileStorage()
     my_model.name = "Holberton"
     my_model.my_number = 89
     self.assertEqual(str(type(FileStorage)), "<class 'type'>")
     self.assertTrue(isinstance(my_model, FileStorage))
     self.assertTrue(type(my_model), object)
 def test_save(self):
     """ test if file.json is saved or created"""
     store = FileStorage()
     self.assertIsInstance(store, FileStorage)
     b1 = BaseModel()
     store.new(b1)
     store.name = "Gary"
     store.my_number = 89
     store.save()
     self.assertTrue(os.path.exists('file.json'))