Пример #1
0
 def test_create_to_dict(self):
     """
     test to verified if the dic is created
     """
     amenity = Amenity()
     dict_new = amenity.to_dict()
     self.assertEqual(type(dict_new), dict)
Пример #2
0
 def test_to_dict_result(self):
     """ Tests the result of the dict"""
     amenity = Amenity()
     new_dict = amenity.to_dict()
     self.assertEqual(new_dict["__class__"], "Amenity")
     self.assertEqual(type(new_dict["created_at"]), str)
     self.assertEqual(type(new_dict["updated_at"]), str)
     self.assertEqual(type(new_dict["id"]), str)
Пример #3
0
 def test_values_to_dict(self):
     """test to verified de values in a dic"""
     amenity = Amenity()
     dict_new = amenity.to_dict()
     self.assertEqual(dict_new["__class__"], "Amenity")
     self.assertEqual(type(dict_new["created_at"]), str)
     self.assertEqual(type(dict_new["updated_at"]), str)
     self.assertEqual(type(dict_new["id"]), str)
Пример #4
0
 def test_to_dict_values(self):
     """test the values in dict"""
     time = "%Y-%m-%dT%H:%M:%S.%f"
     amenity = Amenity()
     new_dict = amenity.to_dict()
     self.assertEqual(new_dict["__class__"], "Amenity")
     self.assertEqual(type(new_dict[c]), str)
     self.assertEqual(type(new_dict[u]), str)
     self.assertEqual(new_dict[c], amenity.created_at.strftime(time))
     self.assertEqual(new_dict[u], amenity.updated_at.strftime(time))
Пример #5
0
 def test_to_dict_f(self):
     """ Tests the dictionary that comes from the father class"""
     amenity = Amenity()
     new_dict = amenity.to_dict()
     self.assertEqual(type(new_dict), dict)
Пример #6
0
 def test_str(self):
     """test that the str method has the correct output"""
     amenity = Amenity()
     string = "[Amenity] ({}) {}".format(amenity.id, amenity.to_dict())
     self.assertEqual(string, str(amenity))