1414cf = None
1515
1616def test_cloudflare (debug = False ):
17+ """ test_cloudflare """
1718 global cf
1819 cf = CloudFlare .CloudFlare (debug = debug )
1920 assert isinstance (cf , CloudFlare .CloudFlare )
@@ -22,6 +23,7 @@ def test_cloudflare(debug=False):
2223zone_id = None
2324
2425def test_find_zone (domain_name = None ):
26+ """ test_find_zone """
2527 global zone_name , zone_id
2628 # grab a random zone identifier from the first 10 zones
2729 if domain_name :
@@ -47,6 +49,7 @@ def test_find_zone(domain_name=None):
4749dns_content3 = None
4850
4951def test_dns_records_create_values ():
52+ """ test_dns_records_create_values """
5053 global dns_name , dns_type , dns_content1 , dns_content2 , dns_content3
5154 dns_name = str (uuid .uuid1 ())
5255 dns_type = 'TXT'
@@ -56,6 +59,7 @@ def test_dns_records_create_values():
5659 print ('dns_record: %s' % (dns_name ), file = sys .stderr )
5760
5861def test_dns_records_port_invalid ():
62+ """ test_dns_records_port_invalid """
5963 # create an invalid DNS record - i.e. txt value for A record IP address
6064 dns_record = {'name' :dns_name , 'type' :'A' , 'content' :'NOT-A-VALID-IP-ADDRESS' }
6165 try :
@@ -70,6 +74,7 @@ def test_dns_records_port_invalid():
7074 assert True
7175
7276def test_dns_records_get1 ():
77+ """ test_dns_records_get1 """
7378 # GET
7479 params = {'name' :dns_name + '.' + zone_name , 'match' :'all' , 'type' :dns_type }
7580 dns_results = cf .zones .dns_records .get (zone_id , params = params )
@@ -78,6 +83,7 @@ def test_dns_records_get1():
7883dns_id = None
7984
8085def test_dns_records_post ():
86+ """ test_dns_records_post """
8187 global dns_id
8288 # POST
8389 dns_record = {'name' :dns_name , 'type' :dns_type , 'content' :dns_content1 }
@@ -91,6 +97,7 @@ def test_dns_records_post():
9197 print ('dns_record: %s %s' % (dns_name , dns_id ), file = sys .stderr )
9298
9399def test_dns_records_get2 ():
100+ """ test_dns_records_get2 """
94101 # GET
95102 params = {'name' :dns_name + '.' + zone_name , 'match' :'all' , 'type' :dns_type }
96103 dns_results = cf .zones .dns_records .get (zone_id , params = params )
@@ -100,13 +107,15 @@ def test_dns_records_get2():
100107 assert dns_results [0 ]['content' ] == dns_content1
101108
102109def test_dns_records_get3 ():
110+ """ test_dns_records_get3 """
103111 # GET
104112 dns_result = cf .zones .dns_records .get (zone_id , dns_id )
105113 assert dns_result ['name' ] == dns_name + '.' + zone_name
106114 assert dns_result ['type' ] == dns_type
107115 assert dns_result ['content' ] == dns_content1
108116
109117def test_dns_records_patch ():
118+ """ test_dns_records_patch """
110119 # PATCH
111120 dns_record = {'content' :dns_content2 }
112121 dns_result = cf .zones .dns_records .patch (zone_id , dns_id , data = dns_record )
@@ -115,6 +124,7 @@ def test_dns_records_patch():
115124 assert dns_result ['content' ] == dns_content2
116125
117126def test_dns_records_put ():
127+ """ test_dns_records_put """
118128 # PUT
119129 dns_record = {'name' :dns_name , 'type' :dns_type , 'content' :dns_content3 }
120130 dns_result = cf .zones .dns_records .put (zone_id , dns_id , data = dns_record )
@@ -123,18 +133,21 @@ def test_dns_records_put():
123133 assert dns_result ['content' ] == dns_content3
124134
125135def test_dns_records_get4 ():
136+ """ test_dns_records_get4 """
126137 # GET
127138 dns_result = cf .zones .dns_records .get (zone_id , dns_id )
128139 assert dns_result ['name' ] == dns_name + '.' + zone_name
129140 assert dns_result ['type' ] == dns_type
130141 assert dns_result ['content' ] == dns_content3
131142
132143def test_dns_records_delete ():
144+ """ test_dns_records_delete """
133145 # DELETE
134146 dns_result = cf .zones .dns_records .delete (zone_id , dns_id )
135147 assert dns_result ['id' ] == dns_id
136148
137149def test_dns_records_get5 ():
150+ """ test_dns_records_get5 """
138151 # GET
139152 params = {'name' :dns_name + '.' + zone_name , 'match' :'all' , 'type' :dns_type }
140153 dns_results = cf .zones .dns_records .get (zone_id , params = params )
0 commit comments