def test_menu_api_public(self):
        """
        REST Api: Test public menu data
        """
        role = self.appbuilder.sm.find_role("Public")
        pvm = self.appbuilder.sm.find_permission_view_menu("menu_access", "Model1")
        self.appbuilder.sm.add_permission_role(role, pvm)
        pvm = self.appbuilder.sm.find_permission_view_menu(
            "menu_access", "Model1Dynamic"
        )
        self.appbuilder.sm.add_permission_role(role, pvm)
        pvm = self.appbuilder.sm.find_permission_view_menu("can_get", "MenuApi")
        self.appbuilder.sm.add_permission_role(role, pvm)

        # Enable Model1Dynamic
        self._conditional_value = True

        uri = "/api/v1/menu/"
        client = self.app.test_client()
        rv = client.get(uri)
        self.assertEqual(rv.status_code, 200)
        data = rv.data.decode("utf-8")
        self.assertIn("Model1", data)
        self.assertIn("Model1Dynamic", data)

        # Disable Model1Dynamic
        self._conditional_value = False

        uri = "/api/v1/menu/"
        client = self.app.test_client()
        rv = client.get(uri)
        self.assertEqual(rv.status_code, 200)
        data = rv.data.decode("utf-8")
        self.assertIn("Model1", data)
        self.assertNotIn("Model1Dynamic", data)

        # Revert test data
        role = self.appbuilder.sm.find_role("Public")
        role.permissions = []
        self.appbuilder.get_session.commit()

        REST Api: Test public menu data
        
tests/test_menu.py