added mig_meow rule creation
This commit is contained in:
81
tests/test_patterns.py
Normal file
81
tests/test_patterns.py
Normal file
@ -0,0 +1,81 @@
|
||||
|
||||
import unittest
|
||||
|
||||
from patterns.file_event_pattern import FileEventPattern
|
||||
|
||||
|
||||
class CorrectnessTests(unittest.TestCase):
|
||||
def setUp(self) -> None:
|
||||
return super().setUp()
|
||||
|
||||
def tearDown(self) -> None:
|
||||
return super().tearDown()
|
||||
|
||||
def testFileEventPatternCreationMinimum(self)->None:
|
||||
FileEventPattern("name", "path", "recipe", "file")
|
||||
|
||||
def testFileEventPatternCreationEmptyName(self)->None:
|
||||
with self.assertRaises(ValueError):
|
||||
FileEventPattern("", "path", "recipe", "file")
|
||||
|
||||
def testFileEventPatternCreationEmptyPath(self)->None:
|
||||
with self.assertRaises(ValueError):
|
||||
FileEventPattern("name", "", "recipe", "file")
|
||||
|
||||
def testFileEventPatternCreationEmptyRecipe(self)->None:
|
||||
with self.assertRaises(ValueError):
|
||||
FileEventPattern("name", "path", "", "file")
|
||||
|
||||
def testFileEventPatternCreationEmptyFile(self)->None:
|
||||
with self.assertRaises(ValueError):
|
||||
FileEventPattern("name", "path", "recipe", "")
|
||||
|
||||
def testFileEventPatternCreationInvalidName(self)->None:
|
||||
with self.assertRaises(ValueError):
|
||||
FileEventPattern("@name", "path", "recipe", "file")
|
||||
|
||||
def testFileEventPatternCreationInvalidRecipe(self)->None:
|
||||
with self.assertRaises(ValueError):
|
||||
FileEventPattern("name", "path", "@recipe", "file")
|
||||
|
||||
def testFileEventPatternCreationInvalidFile(self)->None:
|
||||
with self.assertRaises(ValueError):
|
||||
FileEventPattern("name", "path", "recipe", "@file")
|
||||
|
||||
def testFileEventPatternSetupName(self)->None:
|
||||
name = "name"
|
||||
fep = FileEventPattern(name, "path", "recipe", "file")
|
||||
self.assertEqual(fep.name, name)
|
||||
|
||||
def testFileEventPatternSetupPath(self)->None:
|
||||
path = "path"
|
||||
fep = FileEventPattern("name", path, "recipe", "file")
|
||||
self.assertEqual(fep.triggering_path, path)
|
||||
|
||||
def testFileEventPatternSetupRecipe(self)->None:
|
||||
recipe = "recipe"
|
||||
fep = FileEventPattern("name", "path", recipe, "file")
|
||||
self.assertEqual(fep.recipe, recipe)
|
||||
|
||||
def testFileEventPatternSetupFile(self)->None:
|
||||
file = "file"
|
||||
fep = FileEventPattern("name", "path", "recipe", file)
|
||||
self.assertEqual(fep.triggering_file, file)
|
||||
|
||||
def testFileEventPatternSetupParementers(self)->None:
|
||||
parameters = {
|
||||
"a": 1,
|
||||
"b": True
|
||||
}
|
||||
fep = FileEventPattern(
|
||||
"name", "path", "recipe", "file", parameters=parameters)
|
||||
self.assertEqual(fep.parameters, parameters)
|
||||
|
||||
def testFileEventPatternSetupOutputs(self)->None:
|
||||
outputs = {
|
||||
"a": "a",
|
||||
"b": "b"
|
||||
}
|
||||
fep = FileEventPattern(
|
||||
"name", "path", "recipe", "file", outputs=outputs)
|
||||
self.assertEqual(fep.outputs, outputs)
|
Reference in New Issue
Block a user