def toaster_and_invoker():
    toaster = Appliance('toaster')
    activation_command = appliance_commands.OnCommand(toaster)
    deactivation_command = appliance_commands.OffCommand(toaster)
    command_invoker = invoker.Invoker()
    command_invoker.set_object_commands(
        toaster, (activation_command, deactivation_command))
    return toaster, command_invoker
def ninjas_and_invoker():
    ninjas = Security('ninjas')
    activation_command = security_commands.ArmCommand(ninjas)
    deactivation_command = security_commands.DisarmCommand(ninjas)
    command_invoker = invoker.Invoker()
    command_invoker.set_object_commands(
        ninjas, (activation_command, deactivation_command))
    return ninjas, command_invoker
def door_and_invoker():
    test_door = Door('test door')
    activation_command = door_commands.LockCommand(test_door)
    deactivation_command = door_commands.UnlockCommand(test_door)
    command_invoker = invoker.Invoker()
    command_invoker.set_object_commands(
        test_door, (activation_command, deactivation_command))
    return test_door, command_invoker
def test_null_command_if_unrecognized_object_deactivated():
    with testfixtures.LogCapture() as l:
        command_invoker = invoker.Invoker()
        command_invoker.deactivate('abc')
    l.check(('root', 'INFO', 'null command.'))