|
19 | 19 | class TestSubSesSearches(BaseTest): |
20 | 20 | @pytest.mark.parametrize("return_full_path", [True, False]) |
21 | 21 | def test_local_vs_central_search_methods( |
22 | | - self, project, monkeypatch, return_full_path |
| 22 | + self, project, monkeypatch, return_full_path, tmp_path |
23 | 23 | ): |
24 | 24 | """ |
25 | 25 | Test the `search_local_filesystem` and `search_central_via_connection` |
@@ -55,18 +55,23 @@ def test_local_vs_central_search_methods( |
55 | 55 | test_utils.write_file(central_path / path_.parent.parent.parent / f"{path_.parent.parent.name}.md", contents="hello_world",) |
56 | 56 | # fmt: on |
57 | 57 |
|
58 | | - # Monkeycatch `get_rclone_config_name` to return `local` and set `local` |
59 | | - # as a rclone config entry associated with the local filesystem. By this |
60 | | - # method we can hijack `search_central_via_connection` to run locally |
61 | | - # (though it is set up in practice to run via ssh, gdrive or aws). |
| 58 | + # search_central_via_connection will run the transfer |
| 59 | + # function but with additional checks for rclone password |
| 60 | + # through `run_function_that_requires_encrypted_rclone_config_access`. |
| 61 | + # Here we monkeypatch that to skip all of those checks. |
| 62 | + call_rclone(r"config create local local nounc true") |
| 63 | + |
| 64 | + from datashuttle.utils import rclone |
| 65 | + |
| 66 | + def mock_rclone_caller(_, func, optional=None): |
| 67 | + return func() |
| 68 | + |
62 | 69 | monkeypatch.setattr( |
63 | | - project.cfg, |
64 | | - "get_rclone_config_name", |
65 | | - lambda connection_method: "local", |
| 70 | + rclone, |
| 71 | + "run_function_that_requires_encrypted_rclone_config_access", |
| 72 | + mock_rclone_caller, |
66 | 73 | ) |
67 | 74 |
|
68 | | - call_rclone("config create local local nounc true") |
69 | | - |
70 | 75 | # Perform a range of checks across folders and files |
71 | 76 | # and check the outputs of both approaches match. |
72 | 77 | # fmt: off |
|
0 commit comments