From 3eb3377a7b89393786f2b5036ec82a9a6e8aec7b Mon Sep 17 00:00:00 2001 From: frack113 Date: Thu, 26 Aug 2021 06:51:37 +0200 Subject: [PATCH] check valid date order --- tests/test_rules.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/test_rules.py b/tests/test_rules.py index 4c01de39c..730c2ed0e 100755 --- a/tests/test_rules.py +++ b/tests/test_rules.py @@ -335,6 +335,9 @@ class TestRules(unittest.TestCase): elif len(datefield) != 10: print(Fore.YELLOW + "Rule {} has a malformed 'date' (not 10 chars, should be YYYY/MM/DD).".format(file)) faulty_rules.append(file) + elif datefield[4] != '/' or datefield[7] != '/': + print(Fore.YELLOW + "Rule {} has a malformed 'date' (should be YYYY/MM/DD).".format(file)) + faulty_rules.append(file) self.assertEqual(faulty_rules, [], Fore.RED + "There are rules with missing or malformed 'date' fields. (create one, e.g. date: 2019/01/14)") @@ -350,6 +353,9 @@ class TestRules(unittest.TestCase): elif len(modifiedfield) != 10: print(Fore.YELLOW + "Rule {} has a malformed 'modified' (not 10 chars, should be YYYY/MM/DD).".format(file)) faulty_rules.append(file) + elif modifiedfield[4] != '/' or modifiedfield[7] != '/': + print(Fore.YELLOW + "Rule {} has a malformed 'modified' (should be YYYY/MM/DD).".format(file)) + faulty_rules.append(file) self.assertEqual(faulty_rules, [], Fore.RED + "There are rules with malformed 'modified' fields. (create one, e.g. date: 2019/01/14)")