Ejemplo n.º 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")
Ejemplo n.º 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")
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 9
0
 def get_info():
     info = drsblobs.repsFromTo2OtherInfo()
     info.dns_name1 = "1.example.com"
     info.dns_name2 = "2.example.com"
     return info
Ejemplo n.º 10
0
 def get_info():
     info = drsblobs.repsFromTo2OtherInfo()
     info.dns_name1 = "1.example.com"
     info.dns_name2 = "2.example.com"
     return info