class TestBaseTaskFlowConfig(unittest.TestCase): def setUp(self): self.task_flow_config = BaseTaskFlowConfig({ "tasks": { "deploy": { "description": "Deploy Task" }, "manage": {}, "control": {}, }, "flows": { "coffee": { "description": "Coffee Flow" }, "juice": { "description": "Juice Flow" }, }, }) def test_list_tasks(self): tasks = self.task_flow_config.list_tasks() self.assertEqual(len(tasks), 3) deploy = [task for task in tasks if task["name"] == "deploy"][0] self.assertEqual(deploy["description"], "Deploy Task") def test_get_task(self): task = self.task_flow_config.get_task("deploy") self.assertIsInstance(task, BaseConfig) self.assertIn(("description", "Deploy Task"), task.config.items()) def test_no_task(self): with self.assertRaises(TaskNotFoundError): self.task_flow_config.get_task("robotic_superstar") def test_get_flow(self): flow = self.task_flow_config.get_flow("coffee") self.assertIsInstance(flow, BaseConfig) self.assertIn(("description", "Coffee Flow"), flow.config.items()) def test_no_flow(self): with self.assertRaises(FlowNotFoundError): self.task_flow_config.get_flow("water") def test_list_flows(self): flows = self.task_flow_config.list_flows() self.assertEqual(len(flows), 2) coffee = [flow for flow in flows if flow["name"] == "coffee"][0] self.assertEqual(coffee["description"], "Coffee Flow") def test_suggested_name(self): flows = self.task_flow_config.flows self.assertEqual(len(flows), 2) error_msg = self.task_flow_config.get_suggested_name("bofee", flows) self.assertIn("coffee", error_msg)
def setUp(self): self.task_flow_config = BaseTaskFlowConfig( { "tasks": { "deploy": {"description": "Deploy Task"}, "manage": {}, "control": {}, }, "flows": { "coffee": {"description": "Coffee Flow"}, "juice": {"description": "Juice Flow"}, }, } )
class TestBaseTaskFlowConfig(unittest.TestCase): def setUp(self): self.task_flow_config = BaseTaskFlowConfig( { "tasks": { "deploy": {"description": "Deploy Task"}, "manage": {}, "control": {}, }, "flows": { "coffee": {"description": "Coffee Flow"}, "juice": {"description": "Juice Flow"}, }, } ) def test_list_tasks(self): tasks = self.task_flow_config.list_tasks() self.assertEqual(len(tasks), 3) deploy = [task for task in tasks if task["name"] == "deploy"][0] self.assertEqual(deploy["description"], "Deploy Task") def test_get_task(self): task = self.task_flow_config.get_task("deploy") self.assertIsInstance(task, BaseConfig) self.assertIn(("description", "Deploy Task"), task.config.items()) def test_no_task(self): with self.assertRaises(TaskNotFoundError): self.task_flow_config.get_task("robotic_superstar") def test_get_flow(self): flow = self.task_flow_config.get_flow("coffee") self.assertIsInstance(flow, BaseConfig) self.assertIn(("description", "Coffee Flow"), flow.config.items()) def test_no_flow(self): with self.assertRaises(FlowNotFoundError): self.task_flow_config.get_flow("water") def test_list_flows(self): flows = self.task_flow_config.list_flows() self.assertEqual(len(flows), 2) coffee = [flow for flow in flows if flow["name"] == "coffee"][0] self.assertEqual(coffee["description"], "Coffee Flow")