예제 #1
0
    def test_persistent_graph_locked(self, mock_prop):
        """Return 'True' or 'False' based on code property."""
        mock_prop.return_value = {}
        context = Context(config=self.persist_graph_config)
        context._persistent_graph = True

        context._persistent_graph_lock_code = True
        self.assertTrue(context.persistent_graph_locked)

        context._persistent_graph_lock_code = None
        self.assertFalse(context.persistent_graph_locked)
        mock_prop.assert_called_once()
예제 #2
0
    def test_execute_plan_graph_locked(self):
        """Test execute plan with locked persistent graph."""
        context = Context(config=self.config)
        context._persistent_graph = Graph.from_dict({"stack1": []}, context)
        context._persistent_graph_lock_code = "1111"
        plan = Plan(description="Test", graph=Graph(), context=context)
        print(plan.locked)

        with self.assertRaises(PersistentGraphLocked):
            plan.execute()