Beispiel #1
0
    def setUp(self):
        self.zone = Zone("example.com.")
        zone_file = os.path.join(os.path.dirname(__file__), "files", "example.com")
        self.zone.load_from_file(zone_file)

        self.zone.root.soa.mname = "mname.example.com."
        self.zone.root.soa.rname = "rname.example.com."
        self.zone.root.soa.serial += 1
        self.zone.root.soa.refresh = 1
        self.zone.root.soa.retry = 2
        self.zone.root.soa.expire = 3
        self.zone.root.soa.minttl = 4

        self.zone.add_name("zip.example.com.")
        self.zone.names["zip.example.com."].records("A", create=True).add(
            "10.9.8.7"
        )  # noqa: E501

        mx = self.zone.names["foo.example.com."].records("MX")
        mx.delete((10, "mail.example.com."))
        mx.add((30, "anothermail.example.com."))

        self.zone.names["bar.example.com."].records("A").add("10.20.30.40")

        self.zone.delete_name("foofoo.example.com.")

        self.zone.delete_name("barbar.example.com")

        self.saved_filename = tempfile.mkstemp()[1]
        # self.saved_filename = '/var/tmp/foo.tmp'
        self.zone.save(self.saved_filename)
Beispiel #2
0
    def test_save_autoserial_greater(self):
        saved_filename = tempfile.mkstemp()[1]
        self.zone.save(saved_filename, autoserial=True)

        z = Zone('example.com.')
        z.load_from_file(saved_filename)
        self.assertTrue(z.root.soa.serial >= self.zone.root.soa.serial)
Beispiel #3
0
    def setUp(self):
        self.zone = Zone('example.com.')
        zone_file = os.path.join(os.path.dirname(__file__), 'files',
                                 'example.com')
        self.zone.load_from_file(zone_file)

        self.zone.root.soa.mname = 'mname.example.com.'
        self.zone.root.soa.rname = 'rname.example.com.'
        self.zone.root.soa.serial += 1
        self.zone.root.soa.refresh = 1
        self.zone.root.soa.retry = 2
        self.zone.root.soa.expire = 3
        self.zone.root.soa.minttl = 4

        self.zone.add_name('zip.example.com.')
        self.zone.names['zip.example.com.'].records('A', create=True).add(
            '10.9.8.7')  # noqa: E501

        mx = self.zone.names['foo.example.com.'].records('MX')
        mx.delete((10, 'mail.example.com.'))
        mx.add((30, 'anothermail.example.com.'))

        self.zone.names['bar.example.com.'].records('A').add('10.20.30.40')

        self.zone.delete_name('foofoo.example.com.')

        self.zone.delete_name('barbar.example.com')

        self.saved_filename = tempfile.mkstemp()[1]
        # self.saved_filename = '/var/tmp/foo.tmp'
        self.zone.save(self.saved_filename)
Beispiel #4
0
 def setUp(self):
     self.zone = Zone('example.com.')
     zone_file = os.path.join(os.path.dirname(__file__), 'files',
                              'example.com')
     self.zone.load_from_file(zone_file)
Beispiel #5
0
 def test_unicode_domain(self):
     zone = Zone(u'example.com')
     self.assertEqual(zone.domain, u'example.com.')
Beispiel #6
0
 def test_missing_dot(self):
     zone = Zone('example.com')
     self.assertEqual(zone.domain, 'example.com.')
Beispiel #7
0
 def setUp(self):
     self.zone = Zone("example.com.")
     zone_file = os.path.join(os.path.dirname(__file__), "files", "example.com")
     self.zone.load_from_file(zone_file)
Beispiel #8
0
 def test_unicode_domain(self):
     zone = Zone("example.com")
     self.assertEqual(zone.domain, "example.com.")
Beispiel #9
0
 def test_missing_dot(self):
     zone = Zone("example.com")
     self.assertEqual(zone.domain, "example.com.")