def test_check_pythooutput_pin(self):
     chestfreezer_gpio.GPIO.setup = Mock()
     chestfreezer_gpio.GPIO.output = Mock()        
     chestfreezer_gpio.output_pin(1, False)
             
     chestfreezer_gpio.GPIO.setup.assert_called_once_with(1, chestfreezer_gpio.GPIO.OUT) # @UndefinedVariable
     chestfreezer_gpio.GPIO.output.assert_called_once_with(1, False) # @UndefinedVariable
def _set_device_internal(device_descriptive_string, should_activate, global_state_variable, pin_number):    
    new_global_state = should_activate    
    if should_activate is not global_state_variable:
        print 'Received command to set ' + device_descriptive_string + ' to ' + str(should_activate)        
        if _should_reverse_device_state():             
            should_activate = not should_activate
            print 'Relay normal state is OPEN, therefore activation command flipped to ' + str(should_activate)
        else: print 'Relay normal state is CLOSED, therefore activation command remains ' + str(should_activate)
        # the pins need the opposite value to be triggered 
        chestfreezer_gpio.output_pin(pin_number, not should_activate)
    return new_global_state