fix: allow cp and mv within the current directory and into folders without trailing slash
This commit is contained in:
parent
b2ab1421df
commit
be71728e1a
3 changed files with 43 additions and 7 deletions
|
|
@ -109,6 +109,39 @@ def test_move_tagged_file(tree):
|
|||
assert not (tree / orvani.CONTEXT_FILE).exists()
|
||||
|
||||
|
||||
def test_copy_tags_within_current_directory(tree):
|
||||
o = OrvaniTag()
|
||||
o.add('a.mp3', '#lofi')
|
||||
assert o.move('a.mp3', 'b.mp3', True, False)[0] == 0
|
||||
assert lines(tree) == ['a.mp3 --- #lofi', 'b.mp3 --- #lofi']
|
||||
|
||||
|
||||
def test_rename_within_current_directory(tree):
|
||||
o = OrvaniTag()
|
||||
o.add('a.mp3', '#lofi')
|
||||
assert o.move('a.mp3', 'renamed.mp3', False, True)[0] == 0
|
||||
assert not (tree / 'a.mp3').exists()
|
||||
assert lines(tree) == ['renamed.mp3 --- #lofi']
|
||||
|
||||
|
||||
def test_move_into_directory_without_slash(tree):
|
||||
o = OrvaniTag()
|
||||
o.add('a.mp3', '#lofi')
|
||||
assert o.move('a.mp3', 'sub', False, True)[0] == 0
|
||||
assert (tree / 'sub' / 'a.mp3').exists()
|
||||
assert lines(tree / 'sub') == ['a.mp3 --- #lofi']
|
||||
assert not (tree / orvani.CONTEXT_FILE).exists()
|
||||
|
||||
|
||||
def test_copy_tags_from_subfolder_to_folder(tree):
|
||||
(tree / 'other').mkdir()
|
||||
o = OrvaniTag()
|
||||
o.add('sub/d.txt', '#doc')
|
||||
assert o.move('sub/d.txt', 'other/', True, False)[0] == 0
|
||||
assert lines(tree) == ['other/ --- #doc']
|
||||
assert lines(tree / 'sub') == ['d.txt --- #doc']
|
||||
|
||||
|
||||
def test_config_without_tags(tree):
|
||||
(tree / orvani.CONFIG_FILE).write_text('plugins = ["pdf"]\n')
|
||||
assert OrvaniTag().CONFIG == {'plugins': ['pdf']}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue