import shutil import sys import tempfile import cherrymusicserver as cherry from cherrymusicserver import configuration from cherrymusicserver import database from cherrymusicserver import log from cherrymusicserver import sqlitecache from cherrymusicserver import service sqlitecache.debug = True from cherrymusicserver.database.sql import MemConnector log.setTest() class TestFile(object): def __init__(self, fullpath, parent=None, isdir=None, uid=None): self.uid = uid if uid else -1 self.fullpath = fullpath if not parent else os.path.join(parent.fullpath, fullpath) self.parent = parent self.isdir = fullpath.endswith(os.path.sep) if (isdir is None) else isdir if self.isdir: self.fullpath = fullpath[:-1] self.name = os.path.basename(self.fullpath) self.ext = '' else: self.name, self.ext = os.path.splitext(os.path.basename(fullpath))
# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/> # import nose from mock import * from nose.tools import * import os.path import re from cherrymusicserver import log log.setTest() from cherrymusicserver import pathprovider def test_absOrConfigPath(): relpath = 'relpath' abspath = os.path.abspath(relpath) ok_( pathprovider.absOrConfigPath(relpath).startswith( pathprovider.getConfigPath())) eq_(abspath, pathprovider.absOrConfigPath(abspath)) def test_albumArtFilePath(): """albumArtFilePath contains md5-filename, or no filename with empty argument"""