Example #1
0
    def test_string_from_ndr(self):
        info = drsblobs.repsFromTo2OtherInfo()
        info.dns_name1 = "1.example.com"
        info.dns_name2 = "2.example.com"
        packed = ndr_pack(info)
        gc.collect()

        info_unpacked = ndr_unpack(drsblobs.repsFromTo2OtherInfo, packed)

        self.assertIsNotNone(info_unpacked)
        self.assertEqual(info_unpacked.dns_name1, "1.example.com")
        self.assertEqual(info_unpacked.dns_name2, "2.example.com")
Example #2
0
    def test_string_from_ndr(self):
        info = drsblobs.repsFromTo2OtherInfo()
        info.dns_name1 = "1.example.com"
        info.dns_name2 = "2.example.com"
        packed = ndr_pack(info)
        gc.collect()

        info_unpacked = ndr_unpack(drsblobs.repsFromTo2OtherInfo, packed)

        self.assertIsNotNone(info_unpacked)
        self.assertEqual(info_unpacked.dns_name1, "1.example.com")
        self.assertEqual(info_unpacked.dns_name2, "2.example.com")
Example #3
0
 def test_string_modify_in_place(self):
     info = drsblobs.repsFromTo2OtherInfo()
     info.dns_name1 = "1.example.com"
     info.dns_name2 = "%s.example.com"
     gc.collect()
     self.assertIsNotNone(info)
     self.assertEqual(info.dns_name1, "1.example.com")
     self.assertEqual(info.dns_name2, "%s.example.com")
     info.dns_name1 += ".co.nz"
     info.dns_name2 %= 2
     self.assertEqual(info.dns_name1, "1.example.com.co.nz")
     self.assertEqual(info.dns_name2, "2.example.com")
     del info
Example #4
0
 def test_string_modify_in_place(self):
     info = drsblobs.repsFromTo2OtherInfo()
     info.dns_name1 = "1.example.com"
     info.dns_name2 = "%s.example.com"
     gc.collect()
     self.assertIsNotNone(info)
     self.assertEqual(info.dns_name1, "1.example.com")
     self.assertEqual(info.dns_name2, "%s.example.com")
     info.dns_name1 += ".co.nz"
     info.dns_name2 %= 2
     self.assertEqual(info.dns_name1, "1.example.com.co.nz")
     self.assertEqual(info.dns_name2, "2.example.com")
     del info
Example #5
0
    def test_string_delete(self):
        gc.collect()
        info = drsblobs.repsFromTo2OtherInfo()
        info.dns_name1 = "1.example.com"
        info.dns_name2 = "2.example.com"
        info.dns_name1 = None
        try:
            del info.dns_name2
        except AttributeError:
            pass

        self.assertIsNotNone(info)
        self.assertIsNone(info.dns_name1)
        self.assertIsNotNone(info.dns_name2)
Example #6
0
    def test_string_delete(self):
        gc.collect()
        info = drsblobs.repsFromTo2OtherInfo()
        info.dns_name1 = "1.example.com"
        info.dns_name2 = "2.example.com"
        info.dns_name1 = None
        try:
            del info.dns_name2
        except AttributeError:
            pass

        self.assertIsNotNone(info)
        self.assertIsNone(info.dns_name1)
        self.assertIsNotNone(info.dns_name2)
Example #7
0
    def test_string_from_python(self):
        info = drsblobs.repsFromTo2OtherInfo()
        info.dns_name1 = "hello.example.com"
        info.dns_name2 = "goodbye.example.com"
        gc.collect()
        self.assertIsNotNone(info)
        self.assertEqual(info.dns_name1, "hello.example.com")
        self.assertEqual(info.dns_name2, "goodbye.example.com")

        info.dns_name1 = ""
        info.dns_name2 = "goodbye.example.com"

        self.assertEqual(info.dns_name1, "")
        self.assertEqual(info.dns_name2, "goodbye.example.com")

        info.dns_name2 = None

        self.assertEqual(info.dns_name1, "")
        self.assertIsNone(info.dns_name2)
Example #8
0
    def test_string_from_python(self):
        info = drsblobs.repsFromTo2OtherInfo()
        info.dns_name1 = "hello.example.com"
        info.dns_name2 = "goodbye.example.com"
        gc.collect()
        self.assertIsNotNone(info)
        self.assertEqual(info.dns_name1, "hello.example.com")
        self.assertEqual(info.dns_name2, "goodbye.example.com")

        info.dns_name1 = ""
        info.dns_name2 = "goodbye.example.com"

        self.assertEqual(info.dns_name1, "")
        self.assertEqual(info.dns_name2, "goodbye.example.com")

        info.dns_name2 = None

        self.assertEqual(info.dns_name1, "")
        self.assertIsNone(info.dns_name2)
Example #9
0
 def get_info():
     info = drsblobs.repsFromTo2OtherInfo()
     info.dns_name1 = "1.example.com"
     info.dns_name2 = "2.example.com"
     return info
Example #10
0
 def get_info():
     info = drsblobs.repsFromTo2OtherInfo()
     info.dns_name1 = "1.example.com"
     info.dns_name2 = "2.example.com"
     return info