Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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())
Exemplo n.º 4
0
 def setUp(self):
     self.song = Mock()
     self.template = Mock()
     self.rename_operation = RenameOperation(self.template)
Exemplo n.º 5
0
 def setUp(self):
     self.song = Mock()
     self.template = Mock()
     self.rename_operation = RenameOperation(self.template)