gh-65 Fix files with empty extensions being detected as audio files

This commit is contained in:
Nathan Ostgard 2016-01-07 17:10:55 -08:00
parent 8971ae4cea
commit e56bc9722b
2 changed files with 7 additions and 1 deletions

View File

@ -9,7 +9,7 @@ from video import Video
class Audio(Video): class Audio(Video):
__name__ = 'Audio' __name__ = 'Audio'
extensions = ('m4a') extensions = ('m4a',)
""" """
@param, source, string, The fully qualified path to the audio file @param, source, string, The fully qualified path to the audio file

View File

@ -14,6 +14,7 @@ sys.path.insert(0, os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirna
sys.path.insert(0, os.path.abspath(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))) sys.path.insert(0, os.path.abspath(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))))
import helper import helper
from elodie.media.audio import Audio
from elodie.media.media import Media from elodie.media.media import Media
from elodie.media.photo import Photo from elodie.media.photo import Photo
from elodie.media.video import Video from elodie.media.video import Video
@ -47,6 +48,11 @@ def test_get_class_by_file_unsupported():
assert media is None assert media is None
def test_get_class_by_file_empty():
media = Media.get_class_by_file(helper.get_file('.DS_Store'),
[Photo, Video, Audio])
assert media is None
def is_valid(): def is_valid():
media = Media() media = Media()