Ejemplo n.º 1
0
    def test_array_with_exception(self):
        try:
            rmd = drsblobs.replPropertyMetaDataBlob()

            rmd.version = 1
            rmd.ctr = drsblobs.replPropertyMetaDataCtr1()
            rmd.ctr.count = 3

            rmd1 = drsblobs.replPropertyMetaData1()
            rmd1.attid = 1
            rmd1.version = 2

            rmd2 = drsblobs.replPropertyMetaData1()
            rmd2.attid = 2
            rmd2.version = 2

            rmd3 = drsblobs.replPropertyMetaData1()
            rmd3.attid = 3
            rmd3.version = 2

            rmd.ctr.array = [rmd1, rmd2, rmd3]

            gc.collect()

            self.assertIsNotNone(rmd)
            self.assertEqual(rmd.version, 1)
            self.assertIsNotNone(rmd.ctr)
            self.assertEqual(rmd.ctr.count, 3)
            self.assertEqual(len(rmd.ctr.array), rmd.ctr.count)
            self.assertIsNotNone(rmd.ctr.array[0])
            self.assertEqual(rmd.ctr.array[0].attid, 1)

            raise Exception()
        except:
            pass
Ejemplo n.º 2
0
    def test_array_from_ndr(self):
        rmd = drsblobs.replPropertyMetaDataBlob()

        rmd.version = 1
        rmd.ctr = drsblobs.replPropertyMetaDataCtr1()
        rmd.ctr.count = 3

        rmd1 = drsblobs.replPropertyMetaData1()
        rmd1.attid = 1
        rmd1.version = 2

        rmd2 = drsblobs.replPropertyMetaData1()
        rmd2.attid = 2
        rmd2.version = 2

        rmd3 = drsblobs.replPropertyMetaData1()
        rmd3.attid = 3
        rmd3.version = 2

        rmd.ctr.array = [rmd1, rmd2, rmd3]

        packed = ndr_pack(rmd)
        gc.collect()

        rmd_unpacked = ndr_unpack(drsblobs.replPropertyMetaDataBlob, packed)
        self.assertIsNotNone(rmd_unpacked)
        self.assertEqual(rmd_unpacked.version, 1)
        self.assertIsNotNone(rmd_unpacked.ctr)
        self.assertEqual(rmd_unpacked.ctr.count, 3)
        self.assertEqual(len(rmd_unpacked.ctr.array), rmd_unpacked.ctr.count)
        self.assertIsNotNone(rmd_unpacked.ctr.array[0])
        self.assertEqual(rmd_unpacked.ctr.array[0].attid, 1)

        self.assertEqual(rmd.ctr.array[0].attid,
                         rmd_unpacked.ctr.array[0].attid)
Ejemplo n.º 3
0
    def test_array_delete(self):
        rmd = drsblobs.replPropertyMetaDataBlob()

        rmd.version = 1
        rmd.ctr = drsblobs.replPropertyMetaDataCtr1()
        rmd.ctr.count = 3

        rmd1 = drsblobs.replPropertyMetaData1()
        rmd1.attid = 1
        rmd1.version = 2

        rmd2 = drsblobs.replPropertyMetaData1()
        rmd2.attid = 2
        rmd2.version = 2

        rmd3 = drsblobs.replPropertyMetaData1()
        rmd3.attid = 3
        rmd3.version = 2

        rmd.ctr.array = [rmd1, rmd2, rmd3]
        try:
            del rmd1.version
            self.fail("succeeded in deleting rmd1.version")
        except AttributeError, e:
            pass
Ejemplo n.º 4
0
    def test_array_with_exception(self):
        try:
            rmd = drsblobs.replPropertyMetaDataBlob()

            rmd.version = 1
            rmd.ctr = drsblobs.replPropertyMetaDataCtr1()
            rmd.ctr.count = 3

            rmd1 = drsblobs.replPropertyMetaData1()
            rmd1.attid = 1
            rmd1.version = 2

            rmd2 = drsblobs.replPropertyMetaData1()
            rmd2.attid = 2
            rmd2.version = 2

            rmd3 = drsblobs.replPropertyMetaData1()
            rmd3.attid = 3
            rmd3.version = 2

            rmd.ctr.array = [rmd1, rmd2, rmd3]

            gc.collect()

            self.assertIsNotNone(rmd)
            self.assertEqual(rmd.version, 1)
            self.assertIsNotNone(rmd.ctr)
            self.assertEqual(rmd.ctr.count, 3)
            self.assertEqual(len(rmd.ctr.array), rmd.ctr.count)
            self.assertIsNotNone(rmd.ctr.array[0])
            self.assertEqual(rmd.ctr.array[0].attid, 1)

            raise Exception()
        except:
            pass
Ejemplo n.º 5
0
    def test_array_from_ndr(self):
        rmd = drsblobs.replPropertyMetaDataBlob()

        rmd.version = 1
        rmd.ctr = drsblobs.replPropertyMetaDataCtr1()
        rmd.ctr.count = 3

        rmd1 = drsblobs.replPropertyMetaData1()
        rmd1.attid = 1
        rmd1.version = 2

        rmd2 = drsblobs.replPropertyMetaData1()
        rmd2.attid = 2
        rmd2.version = 2

        rmd3 = drsblobs.replPropertyMetaData1()
        rmd3.attid = 3
        rmd3.version = 2

        rmd.ctr.array = [rmd1, rmd2, rmd3]

        packed = ndr_pack(rmd)
        gc.collect()

        rmd_unpacked = ndr_unpack(drsblobs.replPropertyMetaDataBlob, packed)
        self.assertIsNotNone(rmd_unpacked)
        self.assertEqual(rmd_unpacked.version, 1)
        self.assertIsNotNone(rmd_unpacked.ctr)
        self.assertEqual(rmd_unpacked.ctr.count, 3)
        self.assertEqual(len(rmd_unpacked.ctr.array), rmd_unpacked.ctr.count)
        self.assertIsNotNone(rmd_unpacked.ctr.array[0])
        self.assertEqual(rmd_unpacked.ctr.array[0].attid, 1)

        self.assertEqual(rmd.ctr.array[0].attid,
                         rmd_unpacked.ctr.array[0].attid)
Ejemplo n.º 6
0
    def test_array_delete(self):
        rmd = drsblobs.replPropertyMetaDataBlob()

        rmd.version = 1
        rmd.ctr = drsblobs.replPropertyMetaDataCtr1()
        rmd.ctr.count = 3

        rmd1 = drsblobs.replPropertyMetaData1()
        rmd1.attid = 1
        rmd1.version = 2

        rmd2 = drsblobs.replPropertyMetaData1()
        rmd2.attid = 2
        rmd2.version = 2

        rmd3 = drsblobs.replPropertyMetaData1()
        rmd3.attid = 3
        rmd3.version = 2

        rmd.ctr.array = [rmd1, rmd2, rmd3]
        try:
            del rmd1.version
            self.fail("succeeded in deleting rmd1.version")
        except AttributeError as e:
            pass

        try:
            del rmd.ctr.array
            self.fail("succeeded in deleting rmd.ctr.array")
        except AttributeError as e:
            pass
Ejemplo n.º 7
0
        def get_rmd():
            rmd = drsblobs.replPropertyMetaDataBlob()

            rmd.version = 1
            rmd.ctr = drsblobs.replPropertyMetaDataCtr1()
            rmd.ctr.count = 3

            rmd1 = drsblobs.replPropertyMetaData1()
            rmd1.attid = 1
            rmd1.version = 2

            rmd2 = drsblobs.replPropertyMetaData1()
            rmd2.attid = 2
            rmd2.version = 2

            rmd3 = drsblobs.replPropertyMetaData1()
            rmd3.attid = 3
            rmd3.version = 2

            rmd.ctr.array = [rmd1, rmd2, rmd3]
            return rmd
Ejemplo n.º 8
0
        def get_rmd():
            rmd = drsblobs.replPropertyMetaDataBlob()

            rmd.version = 1
            rmd.ctr = drsblobs.replPropertyMetaDataCtr1()
            rmd.ctr.count = 3

            rmd1 = drsblobs.replPropertyMetaData1()
            rmd1.attid = 1
            rmd1.version = 2

            rmd2 = drsblobs.replPropertyMetaData1()
            rmd2.attid = 2
            rmd2.version = 2

            rmd3 = drsblobs.replPropertyMetaData1()
            rmd3.attid = 3
            rmd3.version = 2

            rmd.ctr.array = [rmd1, rmd2, rmd3]
            return rmd