Esempio n. 1
0
    def test_validate_boolean_value(self):
        valid_booleans = ["True"]
        invalid_booleans = ["TrueWRONG"]

        for valid_boolean in valid_booleans:
            self.assertTrue(_validations.validate_boolean_value(valid_boolean))

        for invalid_boolean in invalid_booleans:
            self.assertFalse(
                _validations.validate_boolean_value(invalid_boolean))
Esempio n. 2
0
    def validate_save_log(self, json, log):
        if not "save_log" in json:
            json["save_log"] = _defaults.default_save_log # if wasn't found in the json, use the default value

        if not _validations.validate_boolean_value(json["save_log"]):
            log.report("error_config_save_log", detail=json["save_log"], critical=True) # will return error if the value is invalid
            return False

        return True
Esempio n. 3
0
    def validate_run_post_sync_script_only_if_a_sync_occur(self, json, log):
        if not "run_post_sync_script_only_if_a_sync_occur" in json:
            json["run_post_sync_script_only_if_a_sync_occur"] = _defaults.default_run_post_sync_script_only_if_a_sync_occur # if wasn't found in the json, use the default value

        if not _validations.validate_boolean_value(json["run_post_sync_script_only_if_a_sync_occur"]):
            log.report("error_config_run_post_sync_script_only_if_a_sync_occur", detail=json["run_post_sync_script_only_if_a_sync_occur"], critical=True) # will return error if the value is invalid
            return False

        return True
Esempio n. 4
0
    def validate_skip_email_if_nothing_happened(self, json, log):
        if not "skip_email_if_nothing_happened" in json:
            json["skip_email_if_nothing_happened"] = _defaults.default_skip_email_on_success  # if wasn't found in the json, use the default value

        if not _validations.validate_boolean_value(json["skip_email_if_nothing_happened"]):
            log.report("skip_email_if_nothing_happened", detail=json["skip_email_if_nothing_happened"], critical=True) # will return error if the value is invalid
            return False

        return True
Esempio n. 5
0
    def validate_enable(self, json, log):
        if not "enable" in json:
            log.report("error_sync_enable_missing")  # has to be specified
            return False

        if not _validations.validate_boolean_value(json["enable"]):
            log.report("error_sync_enable", detail=json["enable"])
            return False

        return True
Esempio n. 6
0
    def validate_file_override(self, json, log):
        if not "file_override" in json:
            json[
                "file_override"] = _defaults.default_file_override  # if wasn't found in the json, use the default value

        if not _validations.validate_boolean_value(json["file_override"]):
            log.report("error_sync_file_override",
                       detail=json["file_override"])
            return False

        return True
Esempio n. 7
0
    def validate_left_files_deletion(self, json, log):
        if not "left_files_deletion" in json:
            json[
                "left_files_deletion"] = _defaults.default_left_files_deletion  # if wasn't found in the json, use the default value

        if not _validations.validate_boolean_value(
                json["left_files_deletion"]):
            log.report("error_sync_left_files_deletion",
                       detail=json["left_files_deletion"])
            return False

        return True
Esempio n. 8
0
    def validate_hierarchy_maintenance(self, json, log):
        if not "hierarchy_maintenance" in json:
            json[
                "hierarchy_maintenance"] = _defaults.default_hierarchy_maintenance  # if wasn't found in the json, use the default value

        if not _validations.validate_boolean_value(
                json["hierarchy_maintenance"]):
            log.report("error_sync_hierarchy_maintenance",
                       detail=json["hierarchy_maintenance"])
            return False

        return True
Esempio n. 9
0
    def validate_unnacurate_comparison(self, json, log):
        if not "inaccurate_comparison" in json:
            json[
                "inaccurate_comparison"] = _defaults.default_inaccurate_comparison  # if wasn't found in the json, use the default value

        if not _validations.validate_boolean_value(
                json["inaccurate_comparison"]):
            log.report("error_sync_inaccurate_comparison",
                       detail=json["inaccurate_comparison"])
            return False

        return True
Esempio n. 10
0
    def validate_destination_filelist_shuffle(self, json, log):
        if not "destination_filelist_shuffle" in json:
            json[
                "destination_filelist_shuffle"] = _defaults.default_destination_filelist_shuffle  # if wasn't found in the json, use the default value

        if not _validations.validate_boolean_value(
                json["destination_filelist_shuffle"]):
            log.report("error_sync_destination_filelist_shuffle",
                       detail=json["destination_filelist_shuffle"])
            return False

        return True
Esempio n. 11
0
    def validate_destination_subfolder_search(self, json, log):
        if not "destination_subfolder_search" in json:
            json[
                "destination_subfolder_search"] = _defaults.default_destination_subfolder_search  # if wasn't found in the json, use the default value

        if not _validations.validate_boolean_value(
                json["destination_subfolder_search"]):
            log.report("error_sync_destination_subfolder_search",
                       detail=json["destination_subfolder_search"])
            return False

        return True