Пример #1
0
class RenameOperationTest(unittest.TestCase):
    def setUp(self):
        self.song = Mock()
        self.template = Mock()
        self.rename_operation = RenameOperation(self.template)

    def test_apply(self):
        self.template.safe_substitute.return_value = ' a filename '

        self.rename_operation.apply(self.song)

        self.template.safe_substitute.assert_called_with(self.song)
        self.assertEquals('a filename', self.song.filename)
Пример #2
0
class RenameOperationTest(unittest.TestCase):

    def setUp(self):
        self.song = Mock()
        self.template = Mock()
        self.rename_operation = RenameOperation(self.template)

    def test_apply(self):
        self.template.safe_substitute.return_value = ' a filename '

        self.rename_operation.apply(self.song)

        self.template.safe_substitute.assert_called_with(self.song)
        self.assertEquals('a filename', self.song.filename)
Пример #3
0
    def from_args(self, args):
        name = args.command

        if name == 'get':
            return GetCommand()
        elif name == 'set':
            return OperationCommand(SetOperation(args.__dict__))
        elif name == 'rename':
            template = FreiTemplate(args.format)
            return OperationCommand(RenameOperation(template))
        elif name == 'extract':
            template = FreiTemplate(args.format)
            return OperationCommand(ExtractOperation(template))
        elif name == 'humanize':
            return OperationCommand(HumanizeOperation())
Пример #4
0
 def setUp(self):
     self.song = Mock()
     self.template = Mock()
     self.rename_operation = RenameOperation(self.template)
Пример #5
0
 def setUp(self):
     self.song = Mock()
     self.template = Mock()
     self.rename_operation = RenameOperation(self.template)