Beispiel #1
0
    def test_serializer(self):
        serializer = Serializer(model=self.testcase)

        result = serializer.serialize_model()

        self.assertEqual(self.testcase.category.pk, result['category_id'])
        self.assertEqual(str(self.testcase.category), result['category'])

        component_pks = []

        for component in self.testcase.component.all():  # pylint: disable=no-member
            component_pks.append(component.pk)

        component_pks.sort()
        result['component'].sort()
        self.assertEqual(component_pks, result['component'])

        self.assertEqual(self.testcase.arguments, result['arguments'])
Beispiel #2
0
 def serialize(self):
     """
     Convert the model for XMLPRC
     """
     serializer = Serializer(model=self)
     return serializer.serialize_model()