From f0d35ec1d16afe470c0a54f7da449ed6d1c26cef Mon Sep 17 00:00:00 2001 From: Vaibhav Rathore Date: Sat, 28 Feb 2026 13:55:37 +0530 Subject: [PATCH] fix: enable Google API in test setup to fix CI server tests Google Calendar validation requires Google API to be enabled in Google Settings. Without this, all LMS Live Class tests fail in CI with "Enable Google API in Google Settings" error. --- .../lms_live_class/test_lms_live_class.py | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/lms/lms/doctype/lms_live_class/test_lms_live_class.py b/lms/lms/doctype/lms_live_class/test_lms_live_class.py index dd6dcdad..2e37c640 100644 --- a/lms/lms/doctype/lms_live_class/test_lms_live_class.py +++ b/lms/lms/doctype/lms_live_class/test_lms_live_class.py @@ -1,8 +1,6 @@ # Copyright (c) 2023, Frappe and Contributors # See license.txt -from unittest.mock import MagicMock, patch - import frappe from frappe.utils import add_days, nowdate @@ -18,8 +16,27 @@ class TestLMSLiveClass(BaseTestUtils): self._setup_batch_flow() self._setup_google_meet() + def tearDown(self): + super().tearDown() + if hasattr(self, "_original_google_settings"): + google_settings = frappe.get_doc("Google Settings") + google_settings.enable = self._original_google_settings["enable"] + google_settings.client_id = self._original_google_settings["client_id"] + google_settings.client_secret = "" + google_settings.save(ignore_permissions=True) + def _setup_google_meet(self): """Create Google Calendar and Google Meet Settings for testing.""" + google_settings = frappe.get_doc("Google Settings") + self._original_google_settings = { + "enable": google_settings.enable, + "client_id": google_settings.client_id, + } + google_settings.enable = 1 + google_settings.client_id = "test-client-id" + google_settings.client_secret = "test-client-secret" + google_settings.save(ignore_permissions=True) + calendar_name = f"Test GCal {frappe.generate_hash(length=6)}" if not frappe.db.exists("Google Calendar", calendar_name): calendar = frappe.get_doc(