コード例 #1
0
class ConvertingNovaEntryNamesToRecordNames(unittest.TestCase):

    def setUp(self):
        self.converter = EntryToRecordConverter(DEFAULT_ZONE)
        self.fake_zone = RsDnsZone(id=5, name="blah.org")

    def test_normal_name(self):
        long_name = self.converter.name_to_long_name("hi", self.fake_zone)
        self.assertEqual("hi.blah.org", long_name)

    def test_short_name(self):
        long_name = self.converter.name_to_long_name("", self.fake_zone)
        self.assertEqual("", long_name)

    def test_long_name(self):
        long_name = self.converter.name_to_long_name("blah.org.",
                                                     self.fake_zone)
        self.assertEqual("blah.org..blah.org", long_name)
コード例 #2
0
class ConvertingRecordsToEntries(unittest.TestCase):

    def setUp(self):
        self.converter = EntryToRecordConverter(DEFAULT_ZONE)
        self.fake_zone = RsDnsZone(id=5, name="blah.org")

    def test_normal_name(self):
        record = Record(None, {"id": 5, "name": "hi.blah.org",
                               "data": "stacker.com [email protected] 13452378",
                               "ttl": 5,
                               "type": "SOA"})
        entry = self.converter.record_to_entry(record=record,
                                               dns_zone=self.fake_zone)
        self.assertEqual("stacker.com [email protected] 13452378", entry.content)
        self.assertEqual("hi.blah.org", entry.name)
        self.assertEqual("5", str(entry.ttl))
        self.assertEqual("SOA", entry.type)
コード例 #3
0
 def setUp(self):
     self.converter = EntryToRecordConverter(DEFAULT_ZONE)
     self.fake_zone = RsDnsZone(id=5, name="blah.org")