summaryrefslogtreecommitdiff
path: root/plugins/security-guidance/tests
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/security-guidance/tests')
-rw-r--r--plugins/security-guidance/tests/test_stop_finding_no_edit_record.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/plugins/security-guidance/tests/test_stop_finding_no_edit_record.py b/plugins/security-guidance/tests/test_stop_finding_no_edit_record.py
index e4ebcdf1..d2dd17dc 100644
--- a/plugins/security-guidance/tests/test_stop_finding_no_edit_record.py
+++ b/plugins/security-guidance/tests/test_stop_finding_no_edit_record.py
@@ -210,6 +210,20 @@ class TestRecordReadWhenTheNoteIsWritten:
assert check([], {"state_resets": 1}) == ([], -1)
assert check([], {"state_overwrites": 2}) == ([], -1)
+ def test_repo_folder_spelled_in_another_case(self, state, monkeypatch):
+ """On a file system that ignores case the edit tool can be given the
+ repo folder, or one above it, in a different case."""
+ repo, check = state
+ monkeypatch.setattr(diffstate, "_FOLD_CASE", True)
+ real = os.path.realpath(str(repo))
+ assert check([os.path.join(real.upper(), "app.py")], {}) == ([], 0)
+ assert check([os.path.join(real.upper(), "APP.PY")], {}) == ([], 0)
+ scope, inside = diffstate.touched_scope(
+ str(repo), str(repo), [os.path.join(real.upper(), "app.py")])
+ assert (scope, inside) == (1, {"app.py"})
+ # A sibling folder is still outside.
+ assert check([os.path.join(real.upper() + "2", "app.py")], {}) == (["app.py"], 1)
+
def test_reading_does_not_write_the_state_file(self, state, tmp_path):
_, check = state
check([], {"touched_paths": []})