2016-04-15 07:12:44 +02:00
|
|
|
# Project imports
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
|
|
|
import hashlib
|
|
|
|
import random
|
|
|
|
import re
|
|
|
|
import shutil
|
|
|
|
import string
|
|
|
|
import tempfile
|
|
|
|
import time
|
|
|
|
|
|
|
|
sys.path.insert(0, os.path.abspath(os.path.dirname(os.path.dirname(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
|
|
|
|
from elodie.media.base import Base
|
2016-04-20 06:24:41 +02:00
|
|
|
from elodie.media.media import Media
|
|
|
|
from elodie.media.audio import Audio
|
|
|
|
from elodie.media.text import Text
|
|
|
|
from elodie.media.photo import Photo
|
|
|
|
from elodie.media.video import Video
|
2016-04-15 07:12:44 +02:00
|
|
|
|
|
|
|
os.environ['TZ'] = 'GMT'
|
|
|
|
|
|
|
|
|
|
|
|
def test_set_album_from_folder_invalid_file():
|
|
|
|
temporary_folder, folder = helper.create_working_folder()
|
|
|
|
|
|
|
|
base_file = helper.get_file('invalid.jpg')
|
|
|
|
origin = '%s/invalid.jpg' % folder
|
|
|
|
|
|
|
|
shutil.copyfile(base_file, origin)
|
|
|
|
|
|
|
|
base = Base(origin)
|
|
|
|
|
|
|
|
status = base.set_album_from_folder()
|
|
|
|
|
|
|
|
assert status == False, status
|
|
|
|
|
2016-04-20 06:24:41 +02:00
|
|
|
def test_get_class_by_file_without_extension():
|
|
|
|
base_file = helper.get_file('withoutextension')
|
|
|
|
|
|
|
|
cls = Base.get_class_by_file(base_file, [Audio, Text, Photo, Video])
|
|
|
|
|
|
|
|
assert cls is None, cls
|