Adding more comments. Testing that the orphan file isn't deleted.

This commit is contained in:
Roland 2019-10-14 17:18:20 -06:00
parent 7a1447207c
commit dc4ce0bda1
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
2 changed files with 6 additions and 2 deletions

View file

@ -19,7 +19,8 @@ well as its meta files) is relative to its Channel's directory.
video['poster_path'] = 'foo.jpg'
video['video_path'] = 'subdir/bar.mp4'
Relative DB paths allow files to be moved without having to rebuild the entire collection.
Relative DB paths allow files to be moved without having to rebuild the entire collection. It also ensures that when
a file is moved, it will not be duplicated in the DB.
"""
import json
import pathlib

View file

@ -162,7 +162,8 @@ class TestAPI(unittest.TestCase):
description3 = pathlib.Path(channel_path / 'channel name_20000103_cdefghijklm_title.description')
description3.touch()
# A orphan meta-file should be ignored. This shouldn't show up anywhere.
# A orphan meta-file should be ignored. This shouldn't show up anywhere. But, it shouldn't be deleted.
# WROLPi should never delete a file.
poster3 = pathlib.Path(channel_path / 'channel name_20000104_defghijklmn_title.jpg')
poster3.touch()
@ -183,3 +184,5 @@ class TestAPI(unittest.TestCase):
{(i['video_path'], i['poster_path'], i['description_path']) for i in channel['videos']},
expected
)
assert poster3.is_file(), 'Orphan jpg file was deleted! WROLPi should never delete files.'