def test_validate_enabled_non_zero(self): """ test validate_enabled function test non zero """ for x in range(1, 179, 3): self.assertEqual(mac_utils.validate_enabled(x), "on")
def test_validate_enabled_0(self): ''' test validate_enabled function test 0 ''' self.assertEqual(mac_utils.validate_enabled(0), 'off')
def test_validate_enabled_off(self): ''' test validate_enabled function test off ''' self.assertEqual(mac_utils.validate_enabled('Off'), 'off')
def test_validate_enabled_on(self): ''' test validate_enabled function test on ''' self.assertEqual(mac_utils.validate_enabled('On'), 'on')
def test_validate_enabled_false(self): ''' test validate_enabled function test False ''' self.assertEqual(mac_utils.validate_enabled(False), 'off')
def test_validate_enabled_non_zero(self): ''' test validate_enabled function test non zero ''' for x in range(1, 179, 3): self.assertEqual(mac_utils.validate_enabled(x), 'on')
def test_validate_enabled_true(self): ''' test validate_enabled function test True ''' self.assertEqual(mac_utils.validate_enabled(True), 'on')
def set_remote_login(enable): ''' Set the remote login (SSH) to either on or off. :param bool enable: True to enable, False to disable. "On" and "Off" are also acceptable values. Additionally you can pass 1 and 0 to represent True and False respectively :return: True if successful, False if not :rtype: bool CLI Example: .. code-block:: bash salt '*' system.set_remote_login True ''' state = validate_enabled(enable) cmd = 'systemsetup -f -setremotelogin {0}'.format(state) return execute_return_success(cmd)
def set_sleep_on_power_button(enabled): ''' Set whether or not the power button can sleep the computer. :param bool enabled: True to enable, False to disable. "On" and "Off" are also acceptable values. Additionally you can pass 1 and 0 to represent True and False respectively :return: True if successful, False if not :rtype: bool CLI Example: .. code-block:: bash salt '*' power.set_sleep_on_power_button True ''' state = validate_enabled(enabled) cmd = 'systemsetup -setallowpowerbuttontosleepcomputer {0}'.format(state) return execute_return_success(cmd)
def set_restart_power_failure(enabled): ''' Set whether or not the computer will automatically restart after a power failure. :param bool enabled: True to enable, False to disable. "On" and "Off" are also acceptable values. Additionally you can pass 1 and 0 to represent True and False respectively :return: True if successful, False if not :rtype: bool CLI Example: .. code-block:: bash salt '*' power.set_restart_power_failure True ''' state = validate_enabled(enabled) cmd = 'systemsetup -setrestartpowerfailure {0}'.format(state) return execute_return_success(cmd)
def set_wake_on_network(enabled): ''' Set whether or not the computer will wake from sleep when network activity is detected. :param bool enabled: True to enable, False to disable. "On" and "Off" are also acceptable values. Additionally you can pass 1 and 0 to represent True and False respectively :return: True if successful, False if not :rtype: bool CLI Example: .. code-block:: bash salt '*' power.set_wake_on_network True ''' state = validate_enabled(enabled) cmd = 'systemsetup -setwakeonnetworkaccess {0}'.format(state) return execute_return_success(cmd)
def set_remote_events(enable): ''' Set whether the server responds to events sent by other computers (such as AppleScripts) :param bool enable: True to enable, False to disable. "On" and "Off" are also acceptable values. Additionally you can pass 1 and 0 to represent True and False respectively :return: True if successful, False if not :rtype: bool CLI Example: .. code-block:: bash salt '*' system.set_remote_events On ''' state = validate_enabled(enable) cmd = 'systemsetup -setremoteappleevents {0}'.format(state) return execute_return_success(cmd)
def set_restart_freeze(enabled): ''' Specifies whether the server restarts automatically after a system freeze. This setting doesn't seem to be editable. The command completes successfully but the setting isn't actually updated. This is probably an OS X bug. The functions remains in case they ever fix the bug. :param bool enabled: True to enable, False to disable. "On" and "Off" are also acceptable values. Additionally you can pass 1 and 0 to represent True and False respectively :return: True if successful, False if not :rtype: bool CLI Example: .. code-block:: bash salt '*' power.set_restart_freeze True ''' state = validate_enabled(enabled) cmd = 'systemsetup -setrestartfreeze {0}'.format(state) return execute_return_success(cmd)
def set_disable_keyboard_on_lock(enable): ''' Get whether or not the keyboard should be disabled when the X Serve enclosure lock is engaged. :param bool enable: True to enable, False to disable. "On" and "Off" are also acceptable values. Additionally you can pass 1 and 0 to represent True and False respectively :return: True if successful, False if not :rtype: bool CLI Example: .. code-block:: bash salt '*' system.set_disable_keyboard_on_lock False ''' state = validate_enabled(enable) cmd = 'systemsetup -setdisablekeyboardwhenenclosurelockisengaged ' \ 'k{0}'.format(state) return execute_return_success(cmd)
def test_validate_enabled_false(self): """ test validate_enabled function test False """ self.assertEqual(mac_utils.validate_enabled(False), "off")
def test_validate_enabled_true(self): """ test validate_enabled function test True """ self.assertEqual(mac_utils.validate_enabled(True), "on")
def test_validate_enabled_0(self): """ test validate_enabled function test 0 """ self.assertEqual(mac_utils.validate_enabled(0), "off")
def test_validate_enabled_off(self): """ test validate_enabled function test off """ self.assertEqual(mac_utils.validate_enabled("Off"), "off")
def test_validate_enabled_on(self): """ test validate_enabled function test on """ self.assertEqual(mac_utils.validate_enabled("On"), "on")