/
opt
/
imh-python
/
lib
/
python3.9
/
site-packages
/
libcloud
/
test
/
dns
/
/opt/imh-python/lib/python3.9/site-packages/libcloud/test/dns
mkdir
upload
Name
Size
Mode
Actions
fixtures/
-
0755
rm
__pycache__/
-
0755
rm
test_auroradns.py
12849
0644
edit
dl
rm
test_base.py
4989
0644
edit
dl
rm
test_buddyns.py
6294
0644
edit
dl
rm
test_cloudflare.py
15093
0644
edit
dl
rm
test_digitalocean.py
7115
0644
edit
dl
rm
test_dnsimple.py
11814
0644
edit
dl
rm
test_dnspod.py
10804
0644
edit
dl
rm
test_durabledns.py
27827
0644
edit
dl
rm
test_gandi.py
12019
0644
edit
dl
rm
test_gandi_live.py
17155
0644
edit
dl
rm
test_godaddy.py
7260
0644
edit
dl
rm
test_google.py
7732
0644
edit
dl
rm
test_hostvirtual.py
10728
0644
edit
dl
rm
test_linode.py
13995
0644
edit
dl
rm
test_liquidweb.py
14079
0644
edit
dl
rm
test_luadns.py
12153
0644
edit
dl
rm
test_nfsn.py
6018
0644
edit
dl
rm
test_nsone.py
10309
0644
edit
dl
rm
test_onapp.py
9538
0644
edit
dl
rm
test_pointdns.py
33526
0644
edit
dl
rm
test_powerdns.py
7764
0644
edit
dl
rm
test_rackspace.py
25793
0644
edit
dl
rm
test_rcodezero.py
8565
0644
edit
dl
rm
test_route53.py
14213
0644
edit
dl
rm
test_softlayer.py
9817
0644
edit
dl
rm
test_vultr.py
12848
0644
edit
dl
rm
test_worldwidedns.py
20383
0644
edit
dl
rm
test_zerigo.py
14587
0644
edit
dl
rm
test_zonomi.py
16113
0644
edit
dl
rm
__init__.py
0
0644
edit
dl
rm
Edit:
/opt/imh-python/lib/python3.9/site-packages/libcloud/test/dns/test_godaddy.py
(7260B)
# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import sys import unittest from libcloud.utils.py3 import httplib from libcloud.dns.drivers.godaddy import GoDaddyDNSDriver from libcloud.test import MockHttp from libcloud.test.file_fixtures import DNSFileFixtures from libcloud.test.secrets import DNS_PARAMS_GODADDY from libcloud.dns.base import Zone, RecordType class GoDaddyTests(unittest.TestCase): def setUp(self): GoDaddyMockHttp.type = None GoDaddyDNSDriver.connectionCls.conn_class = GoDaddyMockHttp self.driver = GoDaddyDNSDriver(*DNS_PARAMS_GODADDY) def assertHasKeys(self, dictionary, keys): for key in keys: self.assertTrue(key in dictionary, 'key "%s" not in dictionary' % (key)) def test_list_zones(self): zones = self.driver.list_zones() self.assertEqual(len(zones), 5) self.assertEqual(zones[0].id, '177184419') self.assertEqual(zones[0].domain, 'aperture-platform.com') def test_ex_check_availability(self): check = self.driver.ex_check_availability("wazzlewobbleflooble.com") self.assertEqual(check.available, True) self.assertEqual(check.price, 14.99) def test_ex_list_tlds(self): tlds = self.driver.ex_list_tlds() self.assertEqual(len(tlds), 331) self.assertEqual(tlds[0].name, 'academy') self.assertEqual(tlds[0].type, 'GENERIC') def test_ex_get_purchase_schema(self): schema = self.driver.ex_get_purchase_schema('com') self.assertEqual(schema['id'], 'https://api.godaddy.com/DomainPurchase#') def test_ex_get_agreements(self): ags = self.driver.ex_get_agreements('com') self.assertEqual(len(ags), 1) self.assertEqual(ags[0].title, 'Domain Name Registration Agreement') def test_ex_purchase_domain(self): fixtures = DNSFileFixtures('godaddy') document = fixtures.load('purchase_request.json') order = self.driver.ex_purchase_domain(document) self.assertEqual(order.order_id, 1) def test_list_records(self): zone = Zone(id='177184419', domain='aperture-platform.com', type='master', ttl=None, driver=self.driver) records = self.driver.list_records(zone) self.assertEqual(len(records), 14) self.assertEqual(records[0].type, RecordType.A) self.assertEqual(records[0].name, '@') self.assertEqual(records[0].data, '50.63.202.42') self.assertEqual(records[0].id, '@:A') def test_get_record(self): record = self.driver.get_record( 'aperture-platform.com', 'www:A') self.assertEqual(record.id, 'www:A') self.assertEqual(record.name, 'www') self.assertEqual(record.type, RecordType.A) self.assertEqual(record.data, '50.63.202.42') def test_create_record(self): zone = Zone(id='177184419', domain='aperture-platform.com', type='master', ttl=None, driver=self.driver) record = self.driver.create_record( zone=zone, name='www', type=RecordType.A, data='50.63.202.42' ) self.assertEqual(record.id, 'www:A') self.assertEqual(record.name, 'www') self.assertEqual(record.type, RecordType.A) self.assertEqual(record.data, '50.63.202.42') def test_update_record(self): record = self.driver.get_record( 'aperture-platform.com', 'www:A') record = self.driver.update_record( record=record, name='www', type=RecordType.A, data='50.63.202.22' ) self.assertEqual(record.id, 'www:A') self.assertEqual(record.name, 'www') self.assertEqual(record.type, RecordType.A) self.assertEqual(record.data, '50.63.202.22') def test_get_zone(self): zone = self.driver.get_zone('aperture-platform.com') self.assertEqual(zone.id, '177184419') self.assertEqual(zone.domain, 'aperture-platform.com') def test_delete_zone(self): zone = Zone(id='177184419', domain='aperture-platform.com', type='master', ttl=None, driver=self.driver) self.driver.delete_zone(zone) class GoDaddyMockHttp(MockHttp): fixtures = DNSFileFixtures('godaddy') def _v1_domains(self, method, url, body, headers): body = self.fixtures.load('v1_domains.json') return (httplib.OK, body, {}, httplib.responses[httplib.OK]) def _v1_domains_aperture_platform_com(self, method, url, body, headers): body = self.fixtures.load('v1_domains_aperture_platform_com.json') return (httplib.OK, body, {}, httplib.responses[httplib.OK]) def _v1_domains_aperture_platform_com_records(self, method, url, body, headers): body = self.fixtures.load('v1_domains_aperture_platform_com_records.json') return (httplib.OK, body, {}, httplib.responses[httplib.OK]) def _v1_domains_available(self, method, url, body, headers): body = self.fixtures.load('v1_domains_available.json') return (httplib.OK, body, {}, httplib.responses[httplib.OK]) def _v1_domains_tlds(self, method, url, body, headers): body = self.fixtures.load('v1_domains_tlds.json') return (httplib.OK, body, {}, httplib.responses[httplib.OK]) def _v1_domains_aperture_platform_com_records_A_www(self, method, url, body, headers): body = self.fixtures.load('v1_domains_aperture_platform_com_records_A_www.json') return (httplib.OK, body, {}, httplib.responses[httplib.OK]) def _v1_domains_purchase_schema_com(self, method, url, body, headers): body = self.fixtures.load('v1_domains_purchase_schema_com.json') return (httplib.OK, body, {}, httplib.responses[httplib.OK]) def _v1_domains_agreements(self, method, url, body, headers): body = self.fixtures.load('v1_domains_agreements.json') return (httplib.OK, body, {}, httplib.responses[httplib.OK]) def _v1_domains_purchase(self, method, url, body, headers): body = self.fixtures.load('v1_domains_purchase.json') return (httplib.OK, body, {}, httplib.responses[httplib.OK]) if __name__ == '__main__': sys.exit(unittest.main())
Save
cmd:
run