Skip to content

Commit 6979100

Browse files
Florian SandelFlorian Sandel
authored andcommitted
remove some unneeded comments
1 parent 8cff2bc commit 6979100

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

certbot_dns_stackit/test_stackit.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -223,29 +223,24 @@ def setUp(self):
223223
def test_setup_credentials_with_service_account(
224224
self, mock_configure_credentials, mock_conf
225225
):
226-
# Simulate `service_account` being set
227226
mock_conf.return_value = "service_account_value"
228227

229228
self.authenticator._setup_credentials()
230229

231-
# Assert _configure_credentials was not called
232230
mock_configure_credentials.assert_not_called()
233-
# Assert service_account is set correctly
234231
self.assertEqual(self.authenticator.service_account, "service_account_value")
235232

236233
@patch.object(Authenticator, "conf")
237234
@patch.object(Authenticator, "_configure_credentials")
238235
def test_setup_credentials_without_service_account(
239236
self, mock_configure_credentials, mock_conf
240237
):
241-
# Simulate `service_account` not being set
242238
mock_conf.return_value = None
243239
mock_creds = Mock()
244240
mock_configure_credentials.return_value = mock_creds
245241

246242
self.authenticator._setup_credentials()
247243

248-
# Assert _configure_credentials was called with the correct arguments
249244
mock_configure_credentials.assert_called_once_with(
250245
"credentials",
251246
"STACKIT credentials for the STACKIT DNS API",
@@ -256,7 +251,6 @@ def test_setup_credentials_without_service_account(
256251
"records in the zone",
257252
},
258253
)
259-
# Assert credentials are set correctly
260254
self.assertEqual(self.authenticator.credentials, mock_creds)
261255

262256
@patch.object(Authenticator, "_get_stackit_client")
@@ -309,6 +303,7 @@ def test_load_service_file(self, mock_load_service_file):
309303
@patch("logging.error")
310304
def test_load_service_file_not_found(self, mock_log, mock_file):
311305
result = self.authenticator._load_service_file("nonexistent_path")
306+
312307
self.assertIsNone(result)
313308
mock_log.assert_called()
314309

@@ -321,6 +316,7 @@ def test_generate_jwt(self, mock_jwt_encode):
321316
"kid": "key_id",
322317
"privateKey": "private_key",
323318
}
319+
324320
self.authenticator._generate_jwt(credentials)
325321
mock_jwt_encode.assert_called()
326322

@@ -332,21 +328,19 @@ def test_generate_jwt_fail(self):
332328
"kid": "key_id",
333329
"privateKey": "not_a_valid_key",
334330
}
331+
335332
with self.assertRaises(jwt.exceptions.InvalidKeyError):
336333
token = self.authenticator._generate_jwt(credentials)
337334
self.assertIsNone(token)
338335

339336
@patch("requests.post")
340337
def test_request_access_token_success(self, mock_post):
341338
mock_response = mock_post.return_value
342-
mock_response.raise_for_status = (
343-
lambda: None
344-
) # Mock raise_for_status to do nothing
339+
mock_response.raise_for_status = lambda: None
345340
mock_response.json.return_value = {"access_token": "mocked_access_token"}
346341

347342
result = self.authenticator._request_access_token("jwt_token_example")
348343

349-
# Assertions
350344
mock_post.assert_called_once_with(
351345
"https://service-account.api.stackit.cloud/token",
352346
data={
@@ -366,7 +360,6 @@ def test_request_access_token_failure_raises_http_error(self, mock_post):
366360

367361
with self.assertRaises(errors.PluginError):
368362
self.authenticator._request_access_token("jwt_token_example")
369-
370363
mock_post.assert_called_once()
371364

372365
@patch(

0 commit comments

Comments
 (0)