Marco Ricci commited on 2024-09-01 11:05:14
Zeige 1 geänderte Dateien mit 23 Einfügungen und 7 Löschungen.
... | ... |
@@ -316,7 +316,12 @@ class TestVaultNativeConfig: |
316 | 316 |
], |
317 | 317 |
) |
318 | 318 |
def test_200_pbkdf2_manually(self, iterations: int, result: bytes) -> None: |
319 |
- assert vault_v03_and_below.VaultNativeConfigParser.pbkdf2(tests.VAULT_MASTER_KEY.encode('utf-8'), 32, iterations) == result |
|
319 |
+ assert ( |
|
320 |
+ vault_v03_and_below.VaultNativeConfigParser.pbkdf2( |
|
321 |
+ tests.VAULT_MASTER_KEY.encode('utf-8'), 32, iterations |
|
322 |
+ ) |
|
323 |
+ == result |
|
324 |
+ ) |
|
320 | 325 |
|
321 | 326 |
@pytest.mark.parametrize( |
322 | 327 |
['parser_class', 'config', 'result'], |
... | ... |
@@ -355,15 +360,26 @@ class TestVaultNativeConfig: |
355 | 360 |
runner=runner, |
356 | 361 |
vault_config=config, |
357 | 362 |
): |
358 |
- parser = parser_class(base64.b64decode(config), tests.VAULT_MASTER_KEY) |
|
363 |
+ parser = parser_class( |
|
364 |
+ base64.b64decode(config), tests.VAULT_MASTER_KEY |
|
365 |
+ ) |
|
359 | 366 |
assert parser() == result |
360 | 367 |
# Now stub out all functions used to calculate the above result. |
361 |
- monkeypatch.setattr(parser, '_parse_contents', null_func('_parse_contents')) |
|
362 |
- monkeypatch.setattr(parser, '_derive_keys', null_func('_derive_keys')) |
|
363 |
- monkeypatch.setattr(parser, '_check_signature', null_func('_check_signature')) |
|
364 |
- monkeypatch.setattr(parser, '_decrypt_payload', null_func('_decrypt_payload')) |
|
368 |
+ monkeypatch.setattr( |
|
369 |
+ parser, '_parse_contents', null_func('_parse_contents') |
|
370 |
+ ) |
|
371 |
+ monkeypatch.setattr( |
|
372 |
+ parser, '_derive_keys', null_func('_derive_keys') |
|
373 |
+ ) |
|
374 |
+ monkeypatch.setattr( |
|
375 |
+ parser, '_check_signature', null_func('_check_signature') |
|
376 |
+ ) |
|
377 |
+ monkeypatch.setattr( |
|
378 |
+ parser, '_decrypt_payload', null_func('_decrypt_payload') |
|
379 |
+ ) |
|
365 | 380 |
assert parser() == result |
366 |
- assert vault_v03_and_below.VaultNativeConfigParser.__call__(parser) == result |
|
381 |
+ super_call = vault_v03_and_below.VaultNativeConfigParser.__call__ |
|
382 |
+ assert super_call(parser) == result |
|
367 | 383 |
|
368 | 384 |
def test_400_no_password(self) -> None: |
369 | 385 |
with pytest.raises(ValueError, match='Password must not be empty'): |
370 | 386 |