2424
2525LOG_LEVEL = "CRITICAL"
2626
27- keys_for_ACME = {"acct_key" : AcmeKey .create ("rsa2048" ), "cert_key" : AcmeKey .create ("rsa2048" )}
27+ ### FIX ME ### even with making the keys new each time, some tests manage to re-register!
28+ # luckily it's working anyway, but it's a good thing most of this will have to be scrapped soon
2829
29- usual_ACME = {
30- "ACME_REQUEST_TIMEOUT" : 1 ,
31- "ACME_AUTH_STATUS_WAIT_PERIOD" : 0 ,
32- "ACME_DIRECTORY_URL" : ACME_DIRECTORY_URL_STAGING ,
33- "LOG_LEVEL" : LOG_LEVEL ,
34- }
35- usual_ACME .update (keys_for_ACME )
30+
31+ def keys_for_ACME ():
32+ return {"acct_key" : AcmeKey .create ("secp256r1" ), "cert_key" : AcmeKey .create ("secp256r1" )}
33+
34+
35+ def usual_ACME ():
36+ res = {
37+ "ACME_REQUEST_TIMEOUT" : 1 ,
38+ "ACME_AUTH_STATUS_WAIT_PERIOD" : 0 ,
39+ "ACME_DIRECTORY_URL" : ACME_DIRECTORY_URL_STAGING ,
40+ "LOG_LEVEL" : LOG_LEVEL ,
41+ }
42+ res .update (keys_for_ACME ())
43+ return res
3644
3745
3846class TestClient (TestCase ):
@@ -57,7 +65,7 @@ def setUp(self):
5765
5866 self .provider = test_utils .ExmpleHttpProvider ()
5967 self .client = sewer .client .Client (
60- domain_name = self .domain_name , provider = self .provider , ** usual_ACME
68+ domain_name = self .domain_name , provider = self .provider , ** usual_ACME ()
6169 )
6270
6371 def tearDown (self ):
@@ -74,7 +82,7 @@ def mock_create_acme_client():
7482 provider = test_utils .ExmpleHttpProvider (),
7583 ACME_DIRECTORY_URL = ACME_DIRECTORY_URL_STAGING ,
7684 LOG_LEVEL = LOG_LEVEL ,
77- ** keys_for_ACME ,
85+ ** keys_for_ACME () ,
7886 )
7987
8088 self .assertRaises (ValueError , mock_create_acme_client )
@@ -243,7 +251,7 @@ def mock_instantiate_client():
243251 domain_name = self .domain_name ,
244252 provider = self .provider ,
245253 domain_alt_names = "domain_alt_names" ,
246- ** usual_ACME ,
254+ ** usual_ACME () ,
247255 )
248256
249257 with self .assertRaises (ValueError ) as raised_exception :
@@ -275,7 +283,7 @@ def setUp(self):
275283 domain_name = "exampleSAN.com" ,
276284 dns_class = self .dns_class ,
277285 domain_alt_names = self .domain_alt_names ,
278- ** usual_ACME ,
286+ ** usual_ACME () ,
279287 )
280288 super (TestClientForSAN , self ).setUp ()
281289
@@ -305,7 +313,7 @@ def setUp(self):
305313 dns_class = self .dns_class ,
306314 domain_alt_names = self .domain_alt_names ,
307315 ACME_AUTH_STATUS_MAX_CHECKS = 1 ,
308- ** usual_ACME ,
316+ ** usual_ACME () ,
309317 )
310318 super (TestClientForWildcard , self ).setUp ()
311319
@@ -327,7 +335,7 @@ def setUp(self):
327335
328336 self .dns_class = test_utils .ExmpleDnsProvider ()
329337 self .client = sewer .client .Client (
330- domain_name = self .domain_name , dns_class = self .dns_class , ** usual_ACME
338+ domain_name = self .domain_name , dns_class = self .dns_class , ** usual_ACME ()
331339 )
332340
333341 def test_get_get_acme_endpoints_failure_results_in_exception_with (self ):
@@ -341,7 +349,7 @@ def mock_create_acme_client():
341349 dns_class = test_utils .ExmpleDnsProvider (), # NOTE: dns_class used here
342350 ACME_DIRECTORY_URL = ACME_DIRECTORY_URL_STAGING ,
343351 LOG_LEVEL = LOG_LEVEL ,
344- ** keys_for_ACME ,
352+ ** keys_for_ACME () ,
345353 )
346354
347355 self .assertRaises (ValueError , mock_create_acme_client )
@@ -377,7 +385,7 @@ def mock_instantiate_client():
377385 domain_name = self .domain_name ,
378386 dns_class = self .dns_class , # NOTE: dns_class used here
379387 domain_alt_names = "domain_alt_names" ,
380- ** usual_ACME ,
388+ ** usual_ACME () ,
381389 )
382390
383391 with self .assertRaises (ValueError ) as raised_exception :
@@ -392,7 +400,7 @@ class TestClientUnits(TestCase):
392400 def __init__ (self , * args , ** kwargs ):
393401 super ().__init__ (* args , ** kwargs )
394402 self .mock_args = {"domain_name" : "example.com" , "LOG_LEVEL" : LOG_LEVEL }
395- self .mock_args .update (keys_for_ACME )
403+ self .mock_args .update (keys_for_ACME () )
396404 self .mock_challenges = [{"ident_value" : "example.com" , "key_auth" : "abcdefgh12345678" }]
397405
398406 def mock_sewer (self , provider ):
0 commit comments