added bones of mig_meow pattern and recipe implementations

This commit is contained in:
PatchOfScotland
2022-12-02 13:14:33 +01:00
parent 9dd2d0c209
commit 07ceca0061
5 changed files with 248 additions and 74 deletions

View File

@ -11,6 +11,71 @@ class CorrectnessTests(unittest.TestCase):
def tearDown(self) -> None:
return super().tearDown()
def testFileEventPattern(self):
pass
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)