def test_populate_records(self):
        provider = self._get_provider()

        rs = []
        rs.append(RecordSet(name='a1', ttl=0, type='A',
                            arecords=[ARecord('1.1.1.1')]))
        rs.append(RecordSet(name='a2', ttl=1, type='A',
                            arecords=[ARecord('1.1.1.1'),
                                      ARecord('2.2.2.2')]))
        rs.append(RecordSet(name='aaaa1', ttl=2, type='AAAA',
                            aaaa_records=[AaaaRecord('1:1ec:1::1')]))
        rs.append(RecordSet(name='aaaa2', ttl=3, type='AAAA',
                            aaaa_records=[AaaaRecord('1:1ec:1::1'),
                                          AaaaRecord('1:1ec:1::2')]))
        rs.append(RecordSet(name='cname1', ttl=4, type='CNAME',
                            cname_record=CnameRecord('cname.unit.test.')))
        rs.append(RecordSet(name='cname2', ttl=5, type='CNAME',
                            cname_record=None))
        rs.append(RecordSet(name='mx1', ttl=6, type='MX',
                            mx_records=[MxRecord(10, 'mx1.unit.test.')]))
        rs.append(RecordSet(name='mx2', ttl=7, type='MX',
                            mx_records=[MxRecord(10, 'mx1.unit.test.'),
                                        MxRecord(11, 'mx2.unit.test.')]))
        rs.append(RecordSet(name='ns1', ttl=8, type='NS',
                            ns_records=[NsRecord('ns1.unit.test.')]))
        rs.append(RecordSet(name='ns2', ttl=9, type='NS',
                            ns_records=[NsRecord('ns1.unit.test.'),
                                        NsRecord('ns2.unit.test.')]))
        rs.append(RecordSet(name='ptr1', ttl=10, type='PTR',
                            ptr_records=[PtrRecord('ptr1.unit.test.')]))
        rs.append(RecordSet(name='ptr2', ttl=11, type='PTR',
                            ptr_records=[PtrRecord(None)]))
        rs.append(RecordSet(name='_srv1._tcp', ttl=12, type='SRV',
                            srv_records=[SrvRecord(1, 2, 3, '1unit.tests.')]))
        rs.append(RecordSet(name='_srv2._tcp', ttl=13, type='SRV',
                            srv_records=[SrvRecord(1, 2, 3, '1unit.tests.'),
                                         SrvRecord(4, 5, 6, '2unit.tests.')]))
        rs.append(RecordSet(name='txt1', ttl=14, type='TXT',
                            txt_records=[TxtRecord('sample text1')]))
        rs.append(RecordSet(name='txt2', ttl=15, type='TXT',
                            txt_records=[TxtRecord('sample text1'),
                                         TxtRecord('sample text2')]))
        rs.append(RecordSet(name='', ttl=16, type='SOA',
                            soa_record=[SoaRecord()]))

        record_list = provider._dns_client.record_sets.list_by_dns_zone
        record_list.return_value = rs

        exists = provider.populate(zone)
        self.assertTrue(exists)

        self.assertEquals(len(zone.records), 16)
azure_records.append(_base3)

_base4 = _AzureRecord('TestAzure', octo_records[4])
_base4.zone_name = 'unit.tests'
_base4.relative_record_set_name = 'cname'
_base4.record_type = 'CNAME'
_base4.params['ttl'] = 3
_base4.params['cname_record'] = CnameRecord('a.unit.tests.')
azure_records.append(_base4)

_base5 = _AzureRecord('TestAzure', octo_records[5])
_base5.zone_name = 'unit.tests'
_base5.relative_record_set_name = 'mx1'
_base5.record_type = 'MX'
_base5.params['ttl'] = 3
_base5.params['mx_records'] = [MxRecord(10, 'mx1.unit.tests.'),
                               MxRecord(20, 'mx2.unit.tests.')]
azure_records.append(_base5)

_base6 = _AzureRecord('TestAzure', octo_records[6])
_base6.zone_name = 'unit.tests'
_base6.relative_record_set_name = 'mx2'
_base6.record_type = 'MX'
_base6.params['ttl'] = 3
_base6.params['mx_records'] = [MxRecord(10, 'mx1.unit.tests.')]
azure_records.append(_base6)

_base7 = _AzureRecord('TestAzure', octo_records[7])
_base7.zone_name = 'unit.tests'
_base7.relative_record_set_name = '@'
_base7.record_type = 'NS'
    def test_populate_records(self):
        provider = self._get_provider()

        rs = []
        recordSet = RecordSet(arecords=[ARecord('1.1.1.1')])
        recordSet.name, recordSet.ttl, recordSet.type = 'a1', 0, 'A'
        rs.append(recordSet)
        recordSet = RecordSet(
            arecords=[ARecord('1.1.1.1'),
                      ARecord('2.2.2.2')])
        recordSet.name, recordSet.ttl, recordSet.type = 'a2', 1, 'A'
        rs.append(recordSet)
        recordSet = RecordSet(aaaa_records=[AaaaRecord('1:1ec:1::1')])
        recordSet.name, recordSet.ttl, recordSet.type = 'aaaa1', 2, 'AAAA'
        rs.append(recordSet)
        recordSet = RecordSet(
            aaaa_records=[AaaaRecord('1:1ec:1::1'),
                          AaaaRecord('1:1ec:1::2')])
        recordSet.name, recordSet.ttl, recordSet.type = 'aaaa2', 3, 'AAAA'
        rs.append(recordSet)
        recordSet = RecordSet(cname_record=CnameRecord('cname.unit.test.'))
        recordSet.name, recordSet.ttl, recordSet.type = 'cname1', 4, 'CNAME'
        rs.append(recordSet)
        recordSet = RecordSet(cname_record=None)
        recordSet.name, recordSet.ttl, recordSet.type = 'cname2', 5, 'CNAME'
        rs.append(recordSet)
        recordSet = RecordSet(mx_records=[MxRecord(10, 'mx1.unit.test.')])
        recordSet.name, recordSet.ttl, recordSet.type = 'mx1', 6, 'MX'
        rs.append(recordSet)
        recordSet = RecordSet(mx_records=[
            MxRecord(10, 'mx1.unit.test.'),
            MxRecord(11, 'mx2.unit.test.')
        ])
        recordSet.name, recordSet.ttl, recordSet.type = 'mx2', 7, 'MX'
        rs.append(recordSet)
        recordSet = RecordSet(ns_records=[NsRecord('ns1.unit.test.')])
        recordSet.name, recordSet.ttl, recordSet.type = 'ns1', 8, 'NS'
        rs.append(recordSet)
        recordSet = RecordSet(ns_records=[
            NsRecord('ns1.unit.test.'),
            NsRecord('ns2.unit.test.')
        ])
        recordSet.name, recordSet.ttl, recordSet.type = 'ns2', 9, 'NS'
        rs.append(recordSet)
        recordSet = RecordSet(ptr_records=[PtrRecord('ptr1.unit.test.')])
        recordSet.name, recordSet.ttl, recordSet.type = 'ptr1', 10, 'PTR'
        rs.append(recordSet)
        recordSet = RecordSet(ptr_records=[PtrRecord(None)])
        recordSet.name, recordSet.ttl, recordSet.type = 'ptr2', 11, 'PTR'
        rs.append(recordSet)
        recordSet = RecordSet(srv_records=[SrvRecord(1, 2, 3, '1unit.tests.')])
        recordSet.name, recordSet.ttl, recordSet.type = '_srv1._tcp', 12, 'SRV'
        rs.append(recordSet)
        recordSet = RecordSet(srv_records=[
            SrvRecord(1, 2, 3, '1unit.tests.'),
            SrvRecord(4, 5, 6, '2unit.tests.')
        ])
        recordSet.name, recordSet.ttl, recordSet.type = '_srv2._tcp', 13, 'SRV'
        rs.append(recordSet)
        recordSet = RecordSet(txt_records=[TxtRecord('sample text1')])
        recordSet.name, recordSet.ttl, recordSet.type = 'txt1', 14, 'TXT'
        rs.append(recordSet)
        recordSet = RecordSet(
            txt_records=[TxtRecord('sample text1'),
                         TxtRecord('sample text2')])
        recordSet.name, recordSet.ttl, recordSet.type = 'txt2', 15, 'TXT'
        rs.append(recordSet)
        recordSet = RecordSet(soa_record=[SoaRecord()])
        recordSet.name, recordSet.ttl, recordSet.type = '', 16, 'SOA'
        rs.append(recordSet)

        record_list = provider._dns_client.record_sets.list_by_dns_zone
        record_list.return_value = rs

        exists = provider.populate(zone)
        self.assertTrue(exists)

        self.assertEquals(len(zone.records), 16)
Пример #4
0
    def test_populate_records(self):
        provider = self._get_provider()

        rs = []
        recordSet = RecordSet(arecords=[ARecord(ipv4_address='1.1.1.1')])
        recordSet.name, recordSet.ttl, recordSet.type = 'a1', 0, 'A'
        recordSet.target_resource = SubResource()
        rs.append(recordSet)
        recordSet = RecordSet(arecords=[
            ARecord(ipv4_address='1.1.1.1'),
            ARecord(ipv4_address='2.2.2.2')
        ])
        recordSet.name, recordSet.ttl, recordSet.type = 'a2', 1, 'A'
        recordSet.target_resource = SubResource()
        rs.append(recordSet)
        aaaa1 = AaaaRecord(ipv6_address='1:1ec:1::1')
        recordSet = RecordSet(aaaa_records=[aaaa1])
        recordSet.name, recordSet.ttl, recordSet.type = 'aaaa1', 2, 'AAAA'
        recordSet.target_resource = SubResource()
        rs.append(recordSet)
        aaaa2 = AaaaRecord(ipv6_address='1:1ec:1::2')
        recordSet = RecordSet(aaaa_records=[aaaa1, aaaa2])
        recordSet.name, recordSet.ttl, recordSet.type = 'aaaa2', 3, 'AAAA'
        recordSet.target_resource = SubResource()
        rs.append(recordSet)
        recordSet = RecordSet(caa_records=[
            CaaRecord(flags=0, tag='issue', value='caa1.unit.tests')
        ])
        recordSet.name, recordSet.ttl, recordSet.type = 'caa1', 4, 'CAA'
        rs.append(recordSet)
        recordSet = RecordSet(caa_records=[
            CaaRecord(flags=0, tag='issue', value='caa1.unit.tests'),
            CaaRecord(flags=0, tag='issue', value='caa2.unit.tests')
        ])
        recordSet.name, recordSet.ttl, recordSet.type = 'caa2', 4, 'CAA'
        rs.append(recordSet)
        cname1 = CnameRecord(cname='cname.unit.test.')
        recordSet = RecordSet(cname_record=cname1)
        recordSet.name, recordSet.ttl, recordSet.type = 'cname1', 5, 'CNAME'
        recordSet.target_resource = SubResource()
        rs.append(recordSet)
        recordSet = RecordSet(
            mx_records=[MxRecord(preference=10, exchange='mx1.unit.test.')])
        recordSet.name, recordSet.ttl, recordSet.type = 'mx1', 7, 'MX'
        rs.append(recordSet)
        recordSet = RecordSet(mx_records=[
            MxRecord(preference=10, exchange='mx1.unit.test.'),
            MxRecord(preference=11, exchange='mx2.unit.test.')
        ])
        recordSet.name, recordSet.ttl, recordSet.type = 'mx2', 8, 'MX'
        rs.append(recordSet)
        recordSet = RecordSet(ns_records=[NsRecord(nsdname='ns1.unit.test.')])
        recordSet.name, recordSet.ttl, recordSet.type = 'ns1', 9, 'NS'
        rs.append(recordSet)
        recordSet = RecordSet(ns_records=[
            NsRecord(nsdname='ns1.unit.test.'),
            NsRecord(nsdname='ns2.unit.test.')
        ])
        recordSet.name, recordSet.ttl, recordSet.type = 'ns2', 10, 'NS'
        rs.append(recordSet)
        ptr1 = PtrRecord(ptrdname='ptr1.unit.test.')
        recordSet = RecordSet(ptr_records=[ptr1])
        recordSet.name, recordSet.ttl, recordSet.type = 'ptr1', 11, 'PTR'
        rs.append(recordSet)
        recordSet = RecordSet(srv_records=[
            SrvRecord(priority=1, weight=2, port=3, target='1unit.tests.')
        ])
        recordSet.name, recordSet.ttl, recordSet.type = '_srv1._tcp', 13, 'SRV'
        rs.append(recordSet)
        recordSet = RecordSet(srv_records=[
            SrvRecord(priority=1, weight=2, port=3, target='1unit.tests.'),
            SrvRecord(priority=4, weight=5, port=6, target='2unit.tests.')
        ])
        recordSet.name, recordSet.ttl, recordSet.type = '_srv2._tcp', 14, 'SRV'
        rs.append(recordSet)
        recordSet = RecordSet(txt_records=[TxtRecord(value='sample text1')])
        recordSet.name, recordSet.ttl, recordSet.type = 'txt1', 15, 'TXT'
        recordSet.target_resource = SubResource()
        rs.append(recordSet)
        recordSet = RecordSet(txt_records=[
            TxtRecord(value='sample text1'),
            TxtRecord(value='sample text2')
        ])
        recordSet.name, recordSet.ttl, recordSet.type = 'txt2', 16, 'TXT'
        recordSet.target_resource = SubResource()
        rs.append(recordSet)
        recordSet = RecordSet(soa_record=[SoaRecord()])
        recordSet.name, recordSet.ttl, recordSet.type = '', 17, 'SOA'
        rs.append(recordSet)
        long_txt = "v=spf1 ip4:10.10.0.0/24 ip4:10.10.1.0/24 ip4:10.10.2.0/24"
        long_txt += " ip4:10.10.3.0/24 ip4:10.10.4.0/24 ip4:10.10.5.0/24 "
        long_txt += " 10.6.0/24 ip4:10.10.7.0/24 ip4:10.10.8.0/24 "
        long_txt += " ip4:10.10.10.0/24 ip4:10.10.11.0/24 ip4:10.10.12.0/24"
        long_txt += " ip4:10.10.13.0/24 ip4:10.10.14.0/24 ip4:10.10.15.0/24"
        long_txt += " ip4:10.10.16.0/24 ip4:10.10.17.0/24 ip4:10.10.18.0/24"
        long_txt += " ip4:10.10.19.0/24 ip4:10.10.20.0/24  ~all"
        recordSet = RecordSet(txt_records=[
            TxtRecord(value='sample value1'),
            TxtRecord(value=long_txt)
        ])
        recordSet.name, recordSet.ttl, recordSet.type = 'txt3', 18, 'TXT'
        recordSet.target_resource = SubResource()
        rs.append(recordSet)

        record_list = provider._dns_client.record_sets.list_by_dns_zone
        record_list.return_value = rs

        zone_list = provider._dns_client.zones.list_by_resource_group
        zone_list.return_value = [zone]

        exists = provider.populate(zone)

        self.assertEquals(len(zone.records), 17)
        self.assertTrue(exists)
Пример #5
0
_base8 = _AzureRecord('TestAzure', octo_records[8])
_base8.zone_name = 'unit.tests'
_base8.relative_record_set_name = 'cname'
_base8.record_type = 'CNAME'
_base8.params['ttl'] = 3
_base8.params['cname_record'] = CnameRecord(cname='a.unit.tests.')
azure_records.append(_base8)

_base9 = _AzureRecord('TestAzure', octo_records[9])
_base9.zone_name = 'unit.tests'
_base9.relative_record_set_name = 'mx1'
_base9.record_type = 'MX'
_base9.params['ttl'] = 3
_base9.params['mx_records'] = [
    MxRecord(preference=10, exchange='mx1.unit.tests.'),
    MxRecord(preference=20, exchange='mx2.unit.tests.')
]
azure_records.append(_base9)

_base10 = _AzureRecord('TestAzure', octo_records[10])
_base10.zone_name = 'unit.tests'
_base10.relative_record_set_name = 'mx2'
_base10.record_type = 'MX'
_base10.params['ttl'] = 3
_base10.params['mx_records'] = [
    MxRecord(preference=10, exchange='mx1.unit.tests.')
]
azure_records.append(_base10)

_base11 = _AzureRecord('TestAzure', octo_records[11])
Пример #6
0
def create_current_record(self):
    # takes in a list of str records, the record type and returns a list of the specific record type
    retrn_lst = []

    if self.record_type == 'A':
        if len(self.records) == 0:
            return retrn_lst
        for each_record in self.records:
            # we want to append to the final list the object type ARecord where the parameter is a str called each_record representing the user input
            retrn_lst.append(ARecord(ipv4_address=each_record))
        return retrn_lst

    elif self.record_type == 'AAAA':
        if len(self.records) == 0:
            return retrn_lst
        for each_record_1 in self.records:
            retrn_lst.append(AaaaRecord(ipv6_address=each_record_1))
        return retrn_lst

    elif self.record_type == 'MX':
        if len(self.records) == 0:
            return retrn_lst
        if len(self.records) != len(self.preference):
            self.fail(
                'You must have an exchange for each preference or vice versa')
        # if type matches to 'MX', loop through records/exchange and preference, using the same indices to create the object
        for i in range(len(self.records)):
            retrn_lst.append(
                MxRecord(preference=int(self.preference[i]),
                         exchange=self.records[i]))
        return retrn_lst

    elif self.record_type == 'NS':
        if len(self.records) == 0:
            return retrn_lst
        for each_record_2 in self.records:
            retrn_lst.append(NsRecord(nsdname=each_record_2))
        return retrn_lst

    elif self.record_type == 'TXT':
        if len(self.records) == 0:
            return retrn_lst
        for each_record_3 in self.records:
            retrn_lst.append(TxtRecord(value=each_record_3))
        return retrn_lst

    elif self.record_type == 'PTR':
        if len(self.records) == 0:
            return retrn_lst
        for each_record_4 in self.records:
            retrn_lst.append(PtrRecord(ptrdname=each_record_4))
        return retrn_lst

    elif self.record_type == 'SRV':
        if len(self.records) == 0:
            return retrn_lst
        count = len(self.records)
        if count != len(self.priority) or count != len(
                self.port) or count != len(self.weight):
            self.fail(
                'You must have a weight, a port and a priority for each target'
            )
        for i in range(len(self.records)):
            retrn_lst.append(
                SrvRecord(priority=int(self.priority[i]),
                          weight=int(self.weight[i]),
                          port=int(self.port[i]),
                          target=self.records[i]))
        return retrn_lst

    elif self.record_type == 'CNAME':
        if len(self.records) > 1:
            self.fail(
                'You cannot have more than one record in a single CNAME record set'
            )
        elif len(self.records) == 0:
            return retrn_lst
        curr = CnameRecord(cname=self.records[0])
        return curr
    return retrn_lst
azure_records.append(_base7)

_base8 = _AzureRecord('TestAzure', octo_records[8])
_base8.zone_name = 'unit.tests'
_base8.relative_record_set_name = 'cname'
_base8.record_type = 'CNAME'
_base8.params['ttl'] = 3
_base8.params['cname_record'] = CnameRecord(cname='a.unit.tests.')
azure_records.append(_base8)

_base9 = _AzureRecord('TestAzure', octo_records[9])
_base9.zone_name = 'unit.tests'
_base9.relative_record_set_name = 'mx1'
_base9.record_type = 'MX'
_base9.params['ttl'] = 3
_base9.params['mx_records'] = [MxRecord(preference=10,
                                        exchange='mx1.unit.tests.'),
                               MxRecord(preference=20,
                                        exchange='mx2.unit.tests.')]
azure_records.append(_base9)

_base10 = _AzureRecord('TestAzure', octo_records[10])
_base10.zone_name = 'unit.tests'
_base10.relative_record_set_name = 'mx2'
_base10.record_type = 'MX'
_base10.params['ttl'] = 3
_base10.params['mx_records'] = [MxRecord(preference=10,
                                         exchange='mx1.unit.tests.')]
azure_records.append(_base10)

_base11 = _AzureRecord('TestAzure', octo_records[11])
_base11.zone_name = 'unit.tests'
Пример #8
0
    def test_populate_records(self):
        provider = self._get_provider()

        rs = []
        recordSet = RecordSet(arecords=[ARecord(ipv4_address='1.1.1.1')])
        recordSet.name, recordSet.ttl, recordSet.type = 'a1', 0, 'A'
        rs.append(recordSet)
        recordSet = RecordSet(arecords=[ARecord(ipv4_address='1.1.1.1'),
                                        ARecord(ipv4_address='2.2.2.2')])
        recordSet.name, recordSet.ttl, recordSet.type = 'a2', 1, 'A'
        rs.append(recordSet)
        aaaa1 = AaaaRecord(ipv6_address='1:1ec:1::1')
        recordSet = RecordSet(aaaa_records=[aaaa1])
        recordSet.name, recordSet.ttl, recordSet.type = 'aaaa1', 2, 'AAAA'
        rs.append(recordSet)
        aaaa2 = AaaaRecord(ipv6_address='1:1ec:1::2')
        recordSet = RecordSet(aaaa_records=[aaaa1,
                                            aaaa2])
        recordSet.name, recordSet.ttl, recordSet.type = 'aaaa2', 3, 'AAAA'
        rs.append(recordSet)
        recordSet = RecordSet(caa_records=[CaaRecord(flags=0,
                                                     tag='issue',
                                                     value='caa1.unit.tests')])
        recordSet.name, recordSet.ttl, recordSet.type = 'caa1', 4, 'CAA'
        rs.append(recordSet)
        recordSet = RecordSet(caa_records=[CaaRecord(flags=0,
                                                     tag='issue',
                                                     value='caa1.unit.tests'),
                                           CaaRecord(flags=0,
                                                     tag='issue',
                                                     value='caa2.unit.tests')])
        recordSet.name, recordSet.ttl, recordSet.type = 'caa2', 4, 'CAA'
        rs.append(recordSet)
        cname1 = CnameRecord(cname='cname.unit.test.')
        recordSet = RecordSet(cname_record=cname1)
        recordSet.name, recordSet.ttl, recordSet.type = 'cname1', 5, 'CNAME'
        rs.append(recordSet)
        recordSet = RecordSet(cname_record=None)
        recordSet.name, recordSet.ttl, recordSet.type = 'cname2', 6, 'CNAME'
        rs.append(recordSet)
        recordSet = RecordSet(mx_records=[MxRecord(preference=10,
                                                   exchange='mx1.unit.test.')])
        recordSet.name, recordSet.ttl, recordSet.type = 'mx1', 7, 'MX'
        rs.append(recordSet)
        recordSet = RecordSet(mx_records=[MxRecord(preference=10,
                                                   exchange='mx1.unit.test.'),
                                          MxRecord(preference=11,
                                                   exchange='mx2.unit.test.')])
        recordSet.name, recordSet.ttl, recordSet.type = 'mx2', 8, 'MX'
        rs.append(recordSet)
        recordSet = RecordSet(ns_records=[NsRecord(nsdname='ns1.unit.test.')])
        recordSet.name, recordSet.ttl, recordSet.type = 'ns1', 9, 'NS'
        rs.append(recordSet)
        recordSet = RecordSet(ns_records=[NsRecord(nsdname='ns1.unit.test.'),
                                          NsRecord(nsdname='ns2.unit.test.')])
        recordSet.name, recordSet.ttl, recordSet.type = 'ns2', 10, 'NS'
        rs.append(recordSet)
        ptr1 = PtrRecord(ptrdname='ptr1.unit.test.')
        recordSet = RecordSet(ptr_records=[ptr1])
        recordSet.name, recordSet.ttl, recordSet.type = 'ptr1', 11, 'PTR'
        rs.append(recordSet)
        recordSet = RecordSet(ptr_records=[PtrRecord(ptrdname=None)])
        recordSet.name, recordSet.ttl, recordSet.type = 'ptr2', 12, 'PTR'
        rs.append(recordSet)
        recordSet = RecordSet(srv_records=[SrvRecord(priority=1,
                                                     weight=2,
                                                     port=3,
                                                     target='1unit.tests.')])
        recordSet.name, recordSet.ttl, recordSet.type = '_srv1._tcp', 13, 'SRV'
        rs.append(recordSet)
        recordSet = RecordSet(srv_records=[SrvRecord(priority=1,
                                                     weight=2,
                                                     port=3,
                                                     target='1unit.tests.'),
                                           SrvRecord(priority=4,
                                                     weight=5,
                                                     port=6,
                                                     target='2unit.tests.')])
        recordSet.name, recordSet.ttl, recordSet.type = '_srv2._tcp', 14, 'SRV'
        rs.append(recordSet)
        recordSet = RecordSet(txt_records=[TxtRecord(value='sample text1')])
        recordSet.name, recordSet.ttl, recordSet.type = 'txt1', 15, 'TXT'
        rs.append(recordSet)
        recordSet = RecordSet(txt_records=[TxtRecord(value='sample text1'),
                                           TxtRecord(value='sample text2')])
        recordSet.name, recordSet.ttl, recordSet.type = 'txt2', 16, 'TXT'
        rs.append(recordSet)
        recordSet = RecordSet(soa_record=[SoaRecord()])
        recordSet.name, recordSet.ttl, recordSet.type = '', 17, 'SOA'
        rs.append(recordSet)

        record_list = provider._dns_client.record_sets.list_by_dns_zone
        record_list.return_value = rs

        exists = provider.populate(zone)
        self.assertTrue(exists)

        self.assertEquals(len(zone.records), 18)