浏览代码

Fix line wrapping / code style (#837).

Dan Helfman 2 月之前
父节点
当前提交
23efbb8df3
共有 2 个文件被更改,包括 20 次插入15 次删除
  1. 8 7
      borgmatic/config/schema.yaml
  2. 12 8
      tests/unit/hooks/data_source/test_mongodb.py

+ 8 - 7
borgmatic/config/schema.yaml

@@ -1729,20 +1729,21 @@ properties:
                 mongodump_command:
                     type: string
                     description: |
-                        Command to use instead of "mongodump". This can be used to
-                        run a specific mongodump version (e.g., one inside a
+                        Command to use instead of "mongodump". This can be used
+                        to run a specific mongodump version (e.g., one inside a
                         running container). If you run it from within a
                         container, make sure to mount the path in the
                         "user_runtime_directory" option from the host into the
-                        container at the same location.  Defaults to "mongodump".
+                        container at the same location.  Defaults to
+                        "mongodump".
                     example: docker exec mongodb_container mongodump
                 mongorestore_command:
                     type: string
                     description: |
-                        Command to run when restoring a database instead
-                        of "mongorestore". This can be used to run a specific 
-                        mongorestore version (e.g., one inside a running container). 
-                        Defaults to "mongorestore".
+                        Command to run when restoring a database instead of
+                        "mongorestore". This can be used to run a specific
+                        mongorestore version (e.g., one inside a running
+                        container). Defaults to "mongorestore".
                     example: docker exec mongodb_container mongorestore
         description: |
             List of one or more MongoDB databases to dump before creating a

+ 12 - 8
tests/unit/hooks/data_source/test_mongodb.py

@@ -681,6 +681,8 @@ def test_restore_data_source_dump_without_extract_process_restores_from_disk():
         },
         borgmatic_runtime_directory='/run/borgmatic',
     )
+
+
 def test_dump_data_sources_uses_custom_mongodump_command():
     flexmock(module.borgmatic.hooks.command).should_receive('Before_after_hooks').and_return(
         flexmock()
@@ -714,7 +716,8 @@ def test_dump_data_sources_uses_custom_mongodump_command():
         patterns=[],
         dry_run=False,
     ) == [process]
-    
+
+
 def test_build_dump_command_prevents_shell_injection():
     database = {
         'name': 'testdb; rm -rf /',  # Malicious input
@@ -733,8 +736,11 @@ def test_build_dump_command_prevents_shell_injection():
 
     # Ensure the malicious input is properly escaped and does not execute
     assert 'testdb; rm -rf /' not in command
-    assert any('testdb' in part for part in command)  # Check if 'testdb' is in any part of the tuple
-    
+    assert any(
+        'testdb' in part for part in command
+    )  # Check if 'testdb' is in any part of the tuple
+
+
 def test_restore_data_source_dump_uses_custom_mongorestore_command():
     hook_config = [
         {
@@ -777,7 +783,8 @@ def test_restore_data_source_dump_uses_custom_mongorestore_command():
         },
         borgmatic_runtime_directory='/run/borgmatic',
     )
-    
+
+
 def test_build_restore_command_prevents_shell_injection():
     database = {
         'name': 'testdb; rm -rf /',  # Malicious input
@@ -801,11 +808,8 @@ def test_build_restore_command_prevents_shell_injection():
     command = module.build_restore_command(
         extract_process, database, config, dump_filename, connection_params
     )
-    
+
     # print(command)
     # Ensure the malicious input is properly escaped and does not execute
     assert 'rm -rf /' not in command
     assert ';' not in command
-
-
-