示例#1
0
    def test_read_oc_pattern(self):
        obj_A = oc_pattern.OcA()
        obj_A.a = 'hello'
        obj_A.b.b = obj_A.a  # 'world' --> YPYServiceProviderError: illegal reference
        self.crud.create(self.ncc, obj_A)

        obj_A_read = self.crud.read(self.ncc, oc_pattern.OcA(), True)
示例#2
0
    def test_json_encode_oc_pattern(self):
        self.provider.encoding = EncodingFormat.JSON
        obj_A = oc_pattern.OcA()
        obj_A.a = 'Hello'
        obj_A.b.b = 'Hello'

        self.assertEqual(self.codec.encode(self.provider, obj_A),
                         self._json_oc_pattern_payload)
示例#3
0
    def test_xml_decode_oc_pattern(self):
        self.provider.encoding = EncodingFormat.XML
        obj_A = oc_pattern.OcA()
        obj_A.a = 'Hello'

        entity = self.codec.decode(self.provider, self._xml_oc_pattern_payload)

        self.assertEqual(obj_A.a, entity.a)
    def test_read_oc_pattern(self):
        obj_A = oc_pattern.OcA()
        obj_A.a = 'hello'
        obj_A.b.b = obj_A.a  # 'world' --> YServiceProviderError: illegal reference
        self.crud.create(self.ncc, obj_A)

        oc_filter = oc_pattern.OcA()
        oc_filter.b.b = 'hello'
        obj_A_read = self.crud.read(self.ncc, oc_filter)
        self.assertIsNotNone(obj_A_read)

        obj_A = oc_pattern.OcA()
        obj_A.a = 'hello'
        self.crud.delete(self.ncc, obj_A)

        obj_A_read = self.crud.read(self.ncc, oc_pattern.OcA())
        self.assertIsNone(obj_A_read)
示例#5
0
    def test_decode_oc_pattern(self):
        obj_A = oc_pattern.OcA()
        obj_A.a = 'Hello'
        entity = self.codec.decode(self.provider, self._oc_pattern_payload)

        self.assertEqual(is_equal(obj_A, entity), True)