Esempio n. 1
0
 def test_add_addr_creates_public_records(self):
     self.z.add_addr('vm00', ip.IPAddress('195.62.125.33'), ['vm00.ipv4'])
     self.assertIn(RR.A('vm00', ip.IPAddress('195.62.125.33')),
                   self.z.external_forward.records)
     self.assertIn(RR.A('vm00', ip.IPAddress('195.62.125.33')),
                   self.z.internal_forward.records)
     self.assertIn(RR.CNAME('vm00.ipv4', 'vm00'),
                   self.z.external_forward.records)
     self.assertIn(RR.CNAME('vm00.ipv4', 'vm00'),
                   self.z.internal_forward.records)
Esempio n. 2
0
 def test_save_returns_true_if_changed(self, now):
     now.return_value = datetime.datetime(2014, 2, 17, tzinfo=pytz.utc)
     with open(self.filename, 'w') as f:
         f.write(self.z.render(2014021703))
     self.z.records.append(RR.A('vm01', ip.IPAddress('192.168.1.1')))
     self.assertTrue(self.z.save())
     with open(self.filename) as f:
         self.assertEqual(f.read(), self.z.render(2014021704))
Esempio n. 3
0
 def test_forward_ipv4(self):
     z = ForwardZone('gocept.net')
     z.add_a('vm00.fe.whq', ip.IPAddress('195.62.125.10'))
     self.assertIn(RR.A('vm00.fe.whq', ip.IPAddress('195.62.125.10')),
                   z.records)
Esempio n. 4
0
 def test_add_addr_creates_no_public_records(self):
     self.z.add_addr('vm00', ip.IPAddress('172.22.48.20'), ['vm00.ipv4'])
     self.assertNotIn(RR.A('vm00', ip.IPAddress('172.22.48.20')),
                      self.z.external_forward.records)
     self.assertNotIn(RR.CNAME('vm00.ipv4', 'vm00'),
                      self.z.external_forward.records)