Merge pull request #1927 from frack113/check_date_order

check valid date order
This commit is contained in:
Florian Roth
2021-08-26 13:55:39 +02:00
committed by GitHub
+6
View File
@@ -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)")