Commit 4f9f3157 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[test][algorithm] Add loop/loop_user loading tests

parent 94515dfa
......@@ -325,6 +325,56 @@ class TestAutonomousAPI_Loading(unittest.TestCase):
# ----------------------------------------------------------
class TestLoopAPI_Loading(unittest.TestCase):
def test_load_valid_algorithm(self):
algorithm = Algorithm(prefix, "autonomous/loop/1")
self.assertEqual(algorithm.name, "autonomous/loop/1")
self.assertTrue(algorithm.valid)
self.assertFalse(algorithm.errors)
self.assertFalse(algorithm.results) # it is not an analyzer
self.assertTrue(algorithm.parameters)
self.assertTrue(algorithm.input_map)
self.assertTrue(algorithm.output_map)
self.assertEqual(algorithm.schema_version, 3)
self.assertEqual(algorithm.api_version, 2)
self.assertEqual(algorithm.type, Algorithm.LOOP)
runnable = algorithm.runner()
self.assertFalse(runnable.ready)
self.assertTrue(
runnable.prepared
) # loop/1 has no prepare method so is prepared
# ----------------------------------------------------------
class TestLoopUserAPI_Loading(unittest.TestCase):
def test_load_valid_algorithm(self):
algorithm = Algorithm(prefix, "autonomous/loop_user/1")
self.assertEqual(algorithm.name, "autonomous/loop_user/1")
self.assertTrue(algorithm.valid)
self.assertFalse(algorithm.errors)
self.assertFalse(algorithm.results) # it is not an analyzer
self.assertFalse(algorithm.parameters) # loop_user/1 has no parameter
self.assertTrue(algorithm.input_map)
self.assertTrue(algorithm.output_map)
self.assertEqual(algorithm.schema_version, 3)
self.assertEqual(algorithm.api_version, 2)
self.assertEqual(algorithm.type, Algorithm.AUTONOMOUS_LOOP_USER)
runnable = algorithm.runner()
self.assertTrue(runnable.ready) # loop_user/1 has no setup method so is ready
self.assertTrue(
runnable.prepared
) # loop/1 has no prepare method so is prepared
# ----------------------------------------------------------
class TestLegacyAPI_Setup(unittest.TestCase):
def __init__(self, methodName="runTest"):
super(TestLegacyAPI_Setup, self).__init__(methodName)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment