mirror of
https://github.com/saltstack-formulas/cron-formula.git
synced 2024-11-27 23:07:46 +01:00
test(saltcheck): remove duplication in config.tst
using a loop
This commit is contained in:
parent
5cdc50f521
commit
72281c7905
@ -16,71 +16,18 @@ validate_cron.{{ task }}_exists:
|
|||||||
assertion_section: identifier
|
assertion_section: identifier
|
||||||
expected-return: {{ task }}
|
expected-return: {{ task }}
|
||||||
|
|
||||||
{%- if 'minute' in task_options %}
|
{%- for section in ['minute', 'hour', 'daymonth', 'month', 'dayweek', 'comment'] %}
|
||||||
validate_cron.{{ task }}_minute:
|
{%- if section in task_options %}
|
||||||
|
validate_cron.{{ task }}_{{ section }}:
|
||||||
module_and_function: cron.get_entry
|
module_and_function: cron.get_entry
|
||||||
args:
|
args:
|
||||||
- {{ task_options.user|default('root') }}
|
- {{ task_options.user|default('root') }}
|
||||||
- {{ task }}
|
- {{ task }}
|
||||||
assertion: assertEqual
|
assertion: assertEqual
|
||||||
assertion_section: minute
|
assertion_section: {{ section }}
|
||||||
expected-return: '{{ task_options.minute }}'
|
expected-return: '{{ task_options.get(section) }}'
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
{%- endfor %}
|
||||||
{%- if 'hour' in task_options %}
|
|
||||||
validate_cron.{{ task }}_hour:
|
|
||||||
module_and_function: cron.get_entry
|
|
||||||
args:
|
|
||||||
- {{ task_options.user|default('root') }}
|
|
||||||
- {{ task }}
|
|
||||||
assertion_section: hour
|
|
||||||
assertion: assertEqual
|
|
||||||
expected-return: '{{ task_options.hour }}'
|
|
||||||
{%- endif %}
|
|
||||||
|
|
||||||
{%- if 'daymonth' in task_options %}
|
|
||||||
validate_cron.{{ task }}_daymonth:
|
|
||||||
module_and_function: cron.get_entry
|
|
||||||
args:
|
|
||||||
- {{ task_options.user|default('root') }}
|
|
||||||
- {{ task }}
|
|
||||||
assertion_section: daymonth
|
|
||||||
assertion: assertEqual
|
|
||||||
expected-return: '{{ task_options.daymonth }}'
|
|
||||||
{%- endif %}
|
|
||||||
|
|
||||||
{%- if 'month' in task_options %}
|
|
||||||
validate_cron.{{ task }}_month:
|
|
||||||
module_and_function: cron.get_entry
|
|
||||||
args:
|
|
||||||
- {{ task_options.user|default('root') }}
|
|
||||||
- {{ task }}
|
|
||||||
assertion_section: month
|
|
||||||
assertion: assertEqual
|
|
||||||
expected-return: '{{ task_options.month }}'
|
|
||||||
{%- endif %}
|
|
||||||
|
|
||||||
{%- if 'dayweek' in task_options %}
|
|
||||||
validate_cron.{{ task }}_dayweek:
|
|
||||||
module_and_function: cron.get_entry
|
|
||||||
args:
|
|
||||||
- {{ task_options.user|default('root') }}
|
|
||||||
- {{ task }}
|
|
||||||
assertion_section: dayweek
|
|
||||||
assertion: assertEqual
|
|
||||||
expected-return: '{{ task_options.dayweek }}'
|
|
||||||
{%- endif %}
|
|
||||||
|
|
||||||
{%- if 'comment' in task_options %}
|
|
||||||
validate_cron.{{ task }}_comment:
|
|
||||||
module_and_function: cron.get_entry
|
|
||||||
args:
|
|
||||||
- {{ task_options.user|default('root') }}
|
|
||||||
- {{ task }}
|
|
||||||
assertion_section: comment
|
|
||||||
assertion: assertEqual
|
|
||||||
expected-return: {{ task_options.comment }}
|
|
||||||
{%- endif %}
|
|
||||||
|
|
||||||
{%- if 'commented' in task_options and task_options.commented %}
|
{%- if 'commented' in task_options and task_options.commented %}
|
||||||
validate_cron.{{ task }}_commented:
|
validate_cron.{{ task }}_commented:
|
||||||
|
Loading…
Reference in New Issue
Block a user