예제 #1
0
 def test_serialize_model_recursion(self):
     """
     Tests a recursive serialization of a model.
     """
     m = AlchemyManager(None)
     field_dict = dict(first=None, second=dict(third=None))
     model = mock.Mock(first=1, second=mock.Mock(third=3))
     resp = m._serialize_model_helper(model, field_dict=field_dict)
     self.assertDictEqual(dict(first=1, second=dict(third=3)), resp)
예제 #2
0
 def test_serialize_model_recursion(self):
     """
     Tests a recursive serialization of a model.
     """
     m = AlchemyManager(None)
     field_dict = dict(first=None, second=dict(third=None))
     model = mock.Mock(first=1, second=mock.Mock(third=3))
     resp = m._serialize_model_helper(model, field_dict=field_dict)
     self.assertDictEqual(dict(first=1, second=dict(third=3)), resp)
예제 #3
0
 def test_serialize_model_list(self):
     """
     Tests serializing a list/set
     """
     m = AlchemyManager(None)
     model = [None, None, None]
     resp = m._serialize_model_helper(model)
     for x in model:
         self.assertIsNone(x)
     self.assertEqual(len(model), 3)
예제 #4
0
 def test_serialize_model_list(self):
     """
     Tests serializing a list/set
     """
     m = AlchemyManager(None)
     model = [None, None, None]
     resp = m._serialize_model_helper(model)
     for x in model:
         self.assertIsNone(x)
     self.assertEqual(len(model), 3)
예제 #5
0
 def test_serialize_model_helper_none(self):
     """
     Tests serializing None
     """
     m = AlchemyManager(None)
     self.assertIsNone(m._serialize_model_helper(None))
예제 #6
0
 def test_serialize_model_helper_none(self):
     """
     Tests serializing None
     """
     m = AlchemyManager(None)
     self.assertIsNone(m._serialize_model_helper(None))