This repository has been archived by the owner on Nov 22, 2024. It is now read-only.
forked from cloudflare-api/python-cloudflare-v4
-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
all tests now similar structure, callable from command line, debug on…
… by default for command line calls
- Loading branch information
Showing
10 changed files
with
212 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,60 @@ | ||
""" test global_request_timeout and max_request_retries """ | ||
|
||
import os | ||
import sys | ||
sys.path.insert(0, os.path.abspath('..')) | ||
|
||
sys.path.insert(0, os.path.abspath('.')) | ||
sys.path.insert(0, os.path.abspath('..')) | ||
import CloudFlare | ||
|
||
class TestCloudflare: | ||
def test_creating_default_client(self): | ||
cf = CloudFlare.CloudFlare() | ||
assert isinstance(cf, CloudFlare.CloudFlare) | ||
global cf | ||
|
||
def test_cloudflare(debug=False): | ||
global cf | ||
cf = CloudFlare.CloudFlare(debug=debug) | ||
assert isinstance(cf, CloudFlare.CloudFlare) | ||
|
||
def test_ips1(): | ||
ips = cf.ips() | ||
assert isinstance(ips, dict) | ||
assert len(ips) > 0 | ||
|
||
def test_cloudflare_with_global_request_timeout(debug=False): | ||
global cf | ||
cf = CloudFlare.CloudFlare(debug=debug, global_request_timeout=10) | ||
assert isinstance(cf, CloudFlare.CloudFlare) | ||
|
||
def test_ips2(): | ||
ips = cf.ips() | ||
assert isinstance(ips, dict) | ||
assert len(ips) > 0 | ||
|
||
def test_cloudflare_with_max_request_retries(debug=False): | ||
global cf | ||
cf = CloudFlare.CloudFlare(debug=debug, max_request_retries=2) | ||
assert isinstance(cf, CloudFlare.CloudFlare) | ||
|
||
def test_ips3(): | ||
ips = cf.ips() | ||
assert isinstance(ips, dict) | ||
assert len(ips) > 0 | ||
|
||
def test_cloudflare_with_global_request_timeout_and__max_request_retries(debug=False): | ||
global cf | ||
cf = CloudFlare.CloudFlare(debug=debug, global_request_timeout=10, max_request_retries=2) | ||
assert isinstance(cf, CloudFlare.CloudFlare) | ||
|
||
def test_with_global_request_timeout(self): | ||
cf = CloudFlare.CloudFlare({'global_request_timeout': 10}) | ||
assert isinstance(cf, CloudFlare.CloudFlare) | ||
def test_ips4(): | ||
ips = cf.ips() | ||
assert isinstance(ips, dict) | ||
assert len(ips) > 0 | ||
|
||
def test_with_max_request_retries(self): | ||
cf = CloudFlare.CloudFlare({'max_request_retries': 2}) | ||
assert isinstance(cf, CloudFlare.CloudFlare) | ||
if __name__ == '__main__': | ||
test_cloudflare(debug=True) | ||
test_ips1() | ||
test_cloudflare_with_global_request_timeout(debug=True) | ||
test_ips2() | ||
test_cloudflare_with_max_request_retries(debug=True) | ||
test_ips3() | ||
test_cloudflare_with_global_request_timeout_and__max_request_retries(debug=True) | ||
test_ips4() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.