Skip to content

Commit

Permalink
run test_Client with log level WARNING to reduce spew (#177)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaney authored May 8, 2020
1 parent e6df7da commit 6ac1e91
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions sewer/tests/test_Client.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class TestClient(TestCase):

def setUp(self):
self.domain_name = "example.com"
self.log_level = "WARNING"
with mock.patch("requests.post") as mock_requests_post, mock.patch(
"requests.get"
) as mock_requests_get:
Expand All @@ -39,6 +40,7 @@ def setUp(self):
ACME_REQUEST_TIMEOUT=1,
ACME_AUTH_STATUS_WAIT_PERIOD=0,
ACME_DIRECTORY_URL=ACME_DIRECTORY_URL_STAGING,
LOG_LEVEL=self.log_level,
)

def tearDown(self):
Expand All @@ -56,6 +58,7 @@ def mock_create_acme_client():
domain_name="example.com",
auth_provider=test_utils.ExmpleAuthProvider(),
ACME_DIRECTORY_URL=ACME_DIRECTORY_URL_STAGING,
LOG_LEVEL=self.log_level,
)

self.assertRaises(ValueError, mock_create_acme_client)
Expand Down Expand Up @@ -267,6 +270,7 @@ def mock_instantiate_client():
ACME_AUTH_STATUS_WAIT_PERIOD=0,
ACME_DIRECTORY_URL=ACME_DIRECTORY_URL_STAGING,
domain_alt_names="domain_alt_names",
LOG_LEVEL=self.log_level,
)

with self.assertRaises(ValueError) as raised_exception:
Expand All @@ -288,6 +292,7 @@ def setUp(self):
"staging.exampleSAN.com",
"www.exampleSAN.com",
]
self.log_level = "WARNING"
with mock.patch("requests.post") as mock_requests_post, mock.patch(
"requests.get"
) as mock_requests_get:
Expand All @@ -302,6 +307,7 @@ def setUp(self):
ACME_REQUEST_TIMEOUT=1,
ACME_AUTH_STATUS_WAIT_PERIOD=0,
ACME_DIRECTORY_URL=ACME_DIRECTORY_URL_STAGING,
LOG_LEVEL=self.log_level,
)
super(TestClientForSAN, self).setUp()

Expand All @@ -318,6 +324,7 @@ def setUp(self):
"staging.exampleSAN.com",
"www.exampleSAN.com",
]
self.log_level = "WARNING"
with mock.patch("requests.post") as mock_requests_post, mock.patch(
"requests.get"
) as mock_requests_get:
Expand All @@ -333,6 +340,7 @@ def setUp(self):
ACME_AUTH_STATUS_WAIT_PERIOD=0,
ACME_AUTH_STATUS_MAX_CHECKS=1,
ACME_DIRECTORY_URL=ACME_DIRECTORY_URL_STAGING,
LOG_LEVEL=self.log_level,
)
super(TestClientForWildcard, self).setUp()

Expand All @@ -344,6 +352,7 @@ class TestClientDnsApiCompatibility(TestCase):

def setUp(self):
self.domain_name = "example.com"
self.log_level = "WARNING"
with mock.patch("requests.post") as mock_requests_post, mock.patch(
"requests.get"
) as mock_requests_get:
Expand All @@ -357,6 +366,7 @@ def setUp(self):
ACME_REQUEST_TIMEOUT=1,
ACME_AUTH_STATUS_WAIT_PERIOD=0,
ACME_DIRECTORY_URL=ACME_DIRECTORY_URL_STAGING,
LOG_LEVEL=self.log_level,
)

def test_get_get_acme_endpoints_failure_results_in_exception_with(self):
Expand All @@ -371,6 +381,7 @@ def mock_create_acme_client():
domain_name="example.com",
dns_class=test_utils.ExmpleDnsProvider(), # NOTE: dns_class used here
ACME_DIRECTORY_URL=ACME_DIRECTORY_URL_STAGING,
LOG_LEVEL=self.log_level,
)

self.assertRaises(ValueError, mock_create_acme_client)
Expand Down Expand Up @@ -409,6 +420,7 @@ def mock_instantiate_client():
ACME_AUTH_STATUS_WAIT_PERIOD=0,
ACME_DIRECTORY_URL=ACME_DIRECTORY_URL_STAGING,
domain_alt_names="domain_alt_names",
LOG_LEVEL=self.log_level,
)

with self.assertRaises(ValueError) as raised_exception:
Expand All @@ -425,6 +437,7 @@ class TestClientHttpAuthProvider(TestCase):

def setUp(self):
self.domain_name = "example.com"
self.log_level = "WARNING"
with mock.patch("requests.post") as mock_requests_post, mock.patch(
"requests.get"
) as mock_requests_get:
Expand All @@ -438,6 +451,7 @@ def setUp(self):
ACME_REQUEST_TIMEOUT=1,
ACME_AUTH_STATUS_WAIT_PERIOD=0,
ACME_DIRECTORY_URL=ACME_DIRECTORY_URL_STAGING,
LOG_LEVEL=self.log_level,
)

def test_create_challenge_file_is_called(self):
Expand Down

0 comments on commit 6ac1e91

Please sign in to comment.