class SetOperationTest(unittest.TestCase): def setUp(self): self.song = Mock() self.tags = {'one': 1, 'two': 2, 'three': 3} self.set_operation = SetOperation(self.tags) def test_apply(self): self.set_operation.apply(self.song) self.song.update.assert_called_with(self.tags)
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())
def setUp(self): self.song = Mock() self.tags = {'one': 1, 'two': 2, 'three': 3} self.set_operation = SetOperation(self.tags)