def get_exported_zone(self, id, **kwargs):
     uri = "{0}/export".format(self.zone_export_uri(id))
     headers = {'Accept': 'text/dns'}
     resp, body = self.client.get(uri, headers=headers)
     if resp.status < 400:
         return resp, ZoneFile.from_text(body)
     return resp, body
 def get_exported_zone(self, id, **kwargs):
     uri = "{0}/export".format(self.zone_export_uri(id))
     headers = {'Accept': 'text/dns'}
     resp, body = self.client.get(uri, headers=headers)
     if resp.status < 400:
         return resp, ZoneFile.from_text(body)
     return resp, body
Example #3
0
    def test_zone_file_model_meta_test(self):
        zone_file = ZoneFile.from_text(
            """
            $ORIGIN mydomain.com.
            $TTL 1234

            mydomain.com.  IN NS ns1.example.com.
            mydomain.com.  IN SOA ns1.example.com. mail.mydomain.com. 1 2 3 4 5
            """)
        self.assertEqual(zone_file.origin, 'mydomain.com.')
        self.assertEqual(zone_file.ttl, 1234)

        ns_record = ZoneFileRecord(
            name='mydomain.com.', type='NS', data='ns1.example.com.')
        soa_record = ZoneFileRecord(
            name='mydomain.com.', type='SOA',
            data='ns1.example.com. mail.mydomain.com. 1 2 3 4 5')

        self.assertEqual(zone_file.records[0], ns_record)
        self.assertEqual(zone_file.records[1], soa_record)
Example #4
0
    def test_zone_file_model_meta_test(self):
        zone_file = ZoneFile.from_text(
            """
            $ORIGIN mydomain.com.
            $TTL 1234

            mydomain.com.  IN NS ns1.example.com.
            mydomain.com.  IN SOA ns1.example.com. mail.mydomain.com. 1 2 3 4 5
            """)
        self.assertEqual('mydomain.com.', zone_file.origin)
        self.assertEqual(1234, zone_file.ttl)

        ns_record = ZoneFileRecord(
            name='mydomain.com.', type='NS', data='ns1.example.com.')
        soa_record = ZoneFileRecord(
            name='mydomain.com.', type='SOA',
            data='ns1.example.com. mail.mydomain.com. 1 2 3 4 5')

        self.assertEqual(zone_file.records[0], ns_record)
        self.assertEqual(zone_file.records[1], soa_record)