def test_patch_export_bad_template(self):
        """Tests that exports with bad template cannot be patched."""
        patch_data = {
            "name": "RandomExport",
            "template_name": "NOTEXIST",
            "ignore_tags": ["ignore_new"],
        }
        response = client.patch(
            "/api/v2/tasks/export/RandomExport", json={"export": patch_data}
        )

        self.assertEqual(response.status_code, 422)
        data = response.json()
        self.assertEqual(
            data["detail"],
            "ExportTask could not be patched: Template NOTEXIST not found",
        )
Tests that exports with bad template cannot be patched.
tests/apiv2/tasks.py