Given the imminent end-of-life for Python 2, I didn't bother making the codebase compatible with both. Signed-off-by: Drew DeVault <sir@cmpwn.com>
41 lines
1.3 KiB
Python
41 lines
1.3 KiB
Python
# -*- Mode: Python; test-case-name: whipper.test.test_common_program -*-
|
|
# vi:si:et:sw=4:sts=4:ts=4
|
|
|
|
|
|
import unittest
|
|
|
|
from whipper.common import program, mbngs, config
|
|
from whipper.command.cd import DEFAULT_DISC_TEMPLATE
|
|
|
|
|
|
class PathTestCase(unittest.TestCase):
|
|
|
|
def testStandardTemplateEmpty(self):
|
|
prog = program.Program(config.Config())
|
|
|
|
path = prog.getPath('/tmp', DEFAULT_DISC_TEMPLATE,
|
|
'mbdiscid', None)
|
|
self.assertEqual(path, ('/tmp/unknown/Unknown Artist - mbdiscid/'
|
|
'Unknown Artist - mbdiscid'))
|
|
|
|
def testStandardTemplateFilled(self):
|
|
prog = program.Program(config.Config())
|
|
md = mbngs.DiscMetadata()
|
|
md.artist = md.sortName = 'Jeff Buckley'
|
|
md.title = 'Grace'
|
|
|
|
path = prog.getPath('/tmp', DEFAULT_DISC_TEMPLATE,
|
|
'mbdiscid', md, 0)
|
|
self.assertEqual(path, ('/tmp/unknown/Jeff Buckley - Grace/'
|
|
'Jeff Buckley - Grace'))
|
|
|
|
def testIssue66TemplateFilled(self):
|
|
prog = program.Program(config.Config())
|
|
md = mbngs.DiscMetadata()
|
|
md.artist = md.sortName = 'Jeff Buckley'
|
|
md.title = 'Grace'
|
|
|
|
path = prog.getPath('/tmp', '%A/%d', 'mbdiscid', md, 0)
|
|
self.assertEqual(path,
|
|
'/tmp/Jeff Buckley/Grace')
|