def password_policy_setup(server, module): from imcsdk.apis.admin.user import strong_password_set from imcsdk.apis.admin.user import is_strong_password_set ansible = module.params strong_password = ansible["strong_password"] to_enable = (False, True)[strong_password == "enabled"] is_enabled = is_strong_password_set(server) if to_enable == is_enabled: return False if not module.check_mode: strong_password_set(server, enable=to_enable) return True
def test_unset_strong_password(): strong_password_set(handle, enable=False) assert_equal(is_strong_password_set(handle), False)
def test_set_strong_password(): strong_password_set(handle) assert_equal(is_strong_password_set(handle), True)