def test__get_smartd_config_without_schedule(): assert get_smartd_config({ "smartctl_args": ["/dev/ada0", "-d", "sat"], "smart_powermode": "never", "smart_difference": 0, "smart_informational": 1, "smart_critical": 2, "smart_email": "", "disk_smartoptions": "--options", }) == textwrap.dedent("""\ /dev/ada0 -d sat -n never -W 0,1,2 -m root -M exec /usr/local/www/freenasUI/tools/smart_alert.py --options""")
def test__get_smartd_config_without_schedule(): assert get_smartd_config({ "smartctl_args": ["/dev/ada0", "-d", "sat"], "smart_powermode": "never", "smart_difference": 0, "smart_informational": 1, "smart_critical": 2, "disk_critical": None, "disk_difference": None, "disk_informational": None, }) == textwrap.dedent("""\ /dev/ada0 -d sat -n never -W 0,1,2 -m root -M exec /usr/local/libexec/smart_alert.py""" )
def test__get_smartd_config_with_temp(): assert get_smartd_config({ "smartctl_args": ["/dev/ada0", "-d", "sat"], "smart_powermode": "never", "smart_difference": 0, "smart_informational": 1, "smart_critical": 2, "disk_smartoptions": "--options", "disk_critical": 50, "disk_difference": 10, "disk_informational": 40, }) == textwrap.dedent("""\ /dev/ada0 -d sat -n never -W 10,40,50 -m root -M exec /usr/local/libexec/smart_alert.py --options""")
def test__get_smartd_config_with_temp(): assert get_smartd_config({ "smartctl_args": ["/dev/ada0", "-d", "sat"], "smart_powermode": "never", "smart_difference": 0, "smart_informational": 1, "smart_critical": 2, "smart_email": "", "disk_smartoptions": "--options", "disk_critical": 50, "disk_difference": 10, "disk_informational": 40, }) == textwrap.dedent("""\ /dev/ada0 -d sat -n never -W 10,40,50 -m root -M exec /usr/local/libexec/smart_alert.py --options""")
def test__get_smartd_config(): assert get_smartd_config({ "smartctl_args": ["/dev/ada0", "-d", "sat"], "smart_powermode": "never", "smart_difference": 0, "smart_informational": 1, "smart_critical": 2, "smart_email": "", "smarttest_type": "S", "smarttest_month": "*/1", "smarttest_daymonth": "*/1", "smarttest_dayweek": "*/1", "smarttest_hour": "*/1", "disk_smartoptions": "--options", }) == textwrap.dedent("""\ /dev/ada0 -d sat -n never -W 0,1,2 -m root -M exec /usr/local/www/freenasUI/tools/smart_alert.py\\ -s S/../.././..\\ --options""")