Skip to content

Commit

Permalink
Add skip_path test (fixes #200)
Browse files Browse the repository at this point in the history
  • Loading branch information
tfeldmann committed Jan 7, 2024
1 parent 34a1741 commit 64b9667
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/core/test_ignore_seen_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,25 @@ def test_ignore_seen_files(fs):
"bar.txt": "",
}
}


def test_issue_200(fs):
# https://github.com/tfeldmann/organize/issues/200
config = """
# try to extract the first date from the file and rename it accordingly
rules:
- name: date_rename
locations: scan
filters:
- name
- extension: txt
- filecontent: '(?P<m>[0123]\d)\.(?P<d>[01]\d)\.(?P<y>[12][09]\d\d)'
actions:
- rename: "{filecontent.y}-{filecontent.m}-{filecontent.d}_{name}.txt"
"""
make_files({"20220401_173738.txt": "Datum: 23.03.2022"}, "scan")
Config.from_string(config).execute(simulate=False)
result = read_files("/scan")
assert result == {
"2022-23-03_20220401_173738.txt": "Datum: 23.03.2022",
}

0 comments on commit 64b9667

Please sign in to comment.