Clean up notes testing functions
Marco Ricci

Marco Ricci commited on 2025-02-04 13:30:22
Zeige 1 geänderte Dateien mit 21 Einfügungen und 9 Löschungen.


They had similar bad defaults and easily avoidable linting overrides
like the no-op test.
... ...
@@ -2455,7 +2455,7 @@ class TestCLI:
2455 2455
         edit_result = """
2456 2456
 
2457 2457
 # - - - - - >8 - - - - - >8 - - - - - >8 - - - - - >8 - - - - -
2458
-contents go here
2458
+insert witty notes here
2459 2459
 """
2460 2460
         runner = click.testing.CliRunner(mix_stderr=False)
2461 2461
         # TODO(the-13th-letter): Rewrite using parenthesized
... ...
@@ -2467,10 +2467,13 @@ contents go here
2467 2467
                 tests.isolated_vault_config(
2468 2468
                     monkeypatch=monkeypatch,
2469 2469
                     runner=runner,
2470
-                    vault_config={'global': {'phrase': 'abc'}, 'services': {}},
2470
+                    vault_config={
2471
+                        'global': {'phrase': 'abc'},
2472
+                        'services': {'sv': {'notes': 'Contents go here'}},
2473
+                    },
2471 2474
                 )
2472 2475
             )
2473
-            monkeypatch.setattr(click, 'edit', lambda *a, **kw: edit_result)  # noqa: ARG005
2476
+            monkeypatch.setattr(click, 'edit', lambda *_a, **_kw: edit_result)
2474 2477
             result_ = runner.invoke(
2475 2478
                 cli.derivepassphrase_vault,
2476 2479
                 ['--config', '--notes', '--', 'sv'],
... ...
@@ -2484,7 +2487,7 @@ contents go here
2484 2487
                 config = json.load(infile)
2485 2488
             assert config == {
2486 2489
                 'global': {'phrase': 'abc'},
2487
-                'services': {'sv': {'notes': 'contents go here'}},
2490
+                'services': {'sv': {'notes': 'insert witty notes here'}},
2488 2491
             }
2489 2492
 
2490 2493
     def test_221_edit_notes_noop(
... ...
@@ -2548,10 +2551,13 @@ contents go here
2548 2551
                 tests.isolated_vault_config(
2549 2552
                     monkeypatch=monkeypatch,
2550 2553
                     runner=runner,
2551
-                    vault_config={'global': {'phrase': 'abc'}, 'services': {}},
2554
+                    vault_config={
2555
+                        'global': {'phrase': 'abc'},
2556
+                        'services': {'sv': {'notes': 'Contents go here'}},
2557
+                    },
2552 2558
                 )
2553 2559
             )
2554
-            monkeypatch.setattr(click, 'edit', lambda *a, **kw: 'long\ntext')  # noqa: ARG005
2560
+            monkeypatch.setattr(click, 'edit', lambda *_a, **_kw: 'long\ntext')
2555 2561
             result_ = runner.invoke(
2556 2562
                 cli.derivepassphrase_vault,
2557 2563
                 ['--config', '--notes', '--', 'sv'],
... ...
@@ -2582,10 +2588,13 @@ contents go here
2582 2588
                 tests.isolated_vault_config(
2583 2589
                     monkeypatch=monkeypatch,
2584 2590
                     runner=runner,
2585
-                    vault_config={'global': {'phrase': 'abc'}, 'services': {}},
2591
+                    vault_config={
2592
+                        'global': {'phrase': 'abc'},
2593
+                        'services': {'sv': {'notes': 'Contents go here'}},
2594
+                    },
2586 2595
                 )
2587 2596
             )
2588
-            monkeypatch.setattr(click, 'edit', lambda *a, **kw: '\n\n')  # noqa: ARG005
2597
+            monkeypatch.setattr(click, 'edit', lambda *_a, **_kw: '')
2589 2598
             result_ = runner.invoke(
2590 2599
                 cli.derivepassphrase_vault,
2591 2600
                 ['--config', '--notes', '--', 'sv'],
... ...
@@ -2599,7 +2608,10 @@ contents go here
2599 2608
                 encoding='UTF-8'
2600 2609
             ) as infile:
2601 2610
                 config = json.load(infile)
2602
-            assert config == {'global': {'phrase': 'abc'}, 'services': {}}
2611
+            assert config == {
2612
+                'global': {'phrase': 'abc'},
2613
+                'services': {'sv': {'notes': 'Contents go here'}},
2614
+            }
2603 2615
 
2604 2616
     @Parametrize.CONFIG_EDITING_VIA_CONFIG_FLAG
2605 2617
     def test_224_store_config_good(
2606 2618