Beispiel #1
0
    def test_serialize_unsupported_type(self):
        obj = FakeModel()
        obj.k1 = MOCK_JSON_UNSERIALIZEABLE['k1']

        doc = json_util.serialize(obj)

        self.assertDictEqual(dict(), doc)
Beispiel #2
0
    def test_serialize(self):
        obj = FakeModel()
        obj.k1 = MOCK_JSON['k1']
        obj.k2 = MOCK_JSON['k2']
        obj.k3 = MOCK_JSON['k3']
        obj.k4 = MOCK_JSON['k4']
        obj.k5 = MOCK_JSON['k5']
        obj.k6 = MOCK_JSON['k6']

        doc = json_util.serialize(obj)

        self.assertDictEqual(MOCK_JSON, doc)
Beispiel #3
0
    def test_serialize(self):
        obj = FakeModel()
        obj.k1 = MOCK_JSON["k1"]
        obj.k2 = MOCK_JSON["k2"]
        obj.k3 = MOCK_JSON["k3"]
        obj.k4 = MOCK_JSON["k4"]
        obj.k5 = MOCK_JSON["k5"]
        obj.k6 = MOCK_JSON["k6"]

        doc = json_util.serialize(obj)

        self.assertDictEqual(MOCK_JSON, doc)