Beispiel #1
0
    def setUpClass(cls):
        cls.cf = cf_service()
        cls.zone_name = 'ex.com'
        try:
            zone = cls.cf.create_zone(cls.zone_name)
        except HTTPServiceError:
            zone = cls.cf.get_zone_by_name(cls.zone_name)
        cls.zone_id = zone['id']
        try:
            record = cls.cf.create_dns_record(
                cls.zone_id, {
                    'name': 'foo.ex.com',
                    'type': 'A',
                    'content': '127.0.0.1',
                    'proxied': False,
                    'ttl': 1,
                })
        except HTTPServiceError:
            for record in cloudflare_paginated_results(cls.cf.get_dns_records,
                                                       args=(cls.zone_id, )):
                if record['name'] == 'foo.ex.com':
                    break
        cls.record_id = record['id']

        for page_rule in cloudflare_paginated_results(cls.cf.get_page_rules,
                                                      args=(cls.zone_id, )):
            cls.cf.delete_page_rule(cls.zone_id, page_rule['id'])

        cls.cfh = CloudFlareHostService()
        cls.user = cls.cfh.user_lookup(email=TEST_USER['email'])
Beispiel #2
0
    def setUpClass(cls):
        cls.cf = cf_service()
        cls.zone_name = 'ex.com'
        try:
            zone = cls.cf.create_zone(cls.zone_name)
        except HTTPServiceError:
            zone = cls.cf.get_zone_by_name(cls.zone_name)
        cls.zone_id = zone['id']
        try:
            record = cls.cf.create_dns_record(cls.zone_id, {
                'name': 'foo.ex.com',
                'type': 'A',
                'content': '127.0.0.1',
                'proxied': False,
                'ttl': 1,
            })
        except HTTPServiceError:
            for record in cloudflare_paginated_results(
                    cls.cf.get_dns_records, args=(cls.zone_id,)):
                if record['name'] == 'foo.ex.com':
                    break
        cls.record_id = record['id']

        for page_rule in cloudflare_paginated_results(
                cls.cf.get_page_rules, args=(cls.zone_id,)):
            cls.cf.delete_page_rule(cls.zone_id, page_rule['id'])

        cls.cfh = CloudFlareHostService()
        cls.user = cls.cfh.user_lookup(email=TEST_USER['email'])
Beispiel #3
0
def tearDownModule():
    cf = cf_service()
    for zone in cloudflare_paginated_results(cf.get_zones):
        cf.delete_zone(zone['id'])
Beispiel #4
0
 def iter_zones(self):
     for zone in cloudflare_paginated_results(self._service.get_zones):
         yield Zone(self, zone)
Beispiel #5
0
 def _get_settings(self):
     self._settings = {}
     for setting in cloudflare_paginated_results(
             self._service.get_zone_settings, args=(self.zone.id, )):
         self._settings[setting['id']] = setting
Beispiel #6
0
 def iter_page_rules(self):
     for page_rule in cloudflare_paginated_results(
             self._service.get_page_rules, args=(self.id, )):
         yield PageRule(self, page_rule)
Beispiel #7
0
 def iter_records(self):
     for record in cloudflare_paginated_results(
             self._service.get_dns_records, args=(self.id, )):
         yield Record(self, record)
Beispiel #8
0
def tearDownModule():
    cf = cf_service()
    for zone in cloudflare_paginated_results(cf.get_zones):
        cf.delete_zone(zone['id'])