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

        zone_list = provider._dns_client.zones.list_by_resource_group
        zone_list.return_value = [AzureZone(location='global'),
                                  AzureZone(location='global')]

        provider._populate_zones()

        self.assertEquals(len(provider._azure_zones), 1)
Beispiel #2
0
    def test_populate_zone(self):
        provider = self._get_provider()

        zone_list = provider._dns_client.zones.list_by_resource_group
        zone_1 = AzureZone(location='global')
        # This is far from ideal but the
        # zone constructor doesn't let me set it on creation
        zone_1.name = "zone-1"
        zone_2 = AzureZone(location='global')
        # This is far from ideal but the
        # zone constructor doesn't let me set it on creation
        zone_2.name = "zone-2"
        zone_list.return_value = [zone_1, zone_2, zone_1]

        provider._populate_zones()

        # This should be returning two zones since two zones are the same
        self.assertEquals(len(provider._azure_zones), 2)