Skip to content

Commit 1e6958f

Browse files
fix: removal of temproary saml toggle
1 parent e03768d commit 1e6958f

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

common/djangoapps/third_party_auth/management/commands/tests/test_saml.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,21 @@
55

66

77
import os
8+
import importlib
89
from io import StringIO
910

1011
from unittest import mock
1112
from ddt import ddt
1213
from django.contrib.sites.models import Site
1314
from django.core.management import call_command
1415
from django.core.management.base import CommandError
16+
from django.db.models import signals
1517
from requests import exceptions
1618
from requests.models import Response
1719

1820
from openedx.core.djangolib.testing.utils import CacheIsolationTestCase, skip_unless_lms
21+
from common.djangoapps.third_party_auth.models import SAMLConfiguration
22+
from common.djangoapps.third_party_auth.signals import handlers
1923
from common.djangoapps.third_party_auth.tests.factories import SAMLConfigurationFactory, SAMLProviderConfigFactory
2024

2125

@@ -60,6 +64,10 @@ def setUp(self):
6064
"""
6165
super().setUp()
6266

67+
# Disconnect signal handlers to prevent automatic provider config updates during test setup
68+
# These tests manually create multiple versions of configs and expect specific counts
69+
signals.post_save.disconnect(sender=SAMLConfiguration)
70+
6371
self.stdout = StringIO()
6472
self.site = Site.objects.get_current()
6573
self.other_site = Site.objects.create(domain='other.example.com', name='Other Site')
@@ -81,6 +89,14 @@ def setUp(self):
8189
metadata_source='https://www.testshib.org/metadata/testshib-providers.xml',
8290
)
8391

92+
def tearDown(self):
93+
"""
94+
Reconnect signal handlers after tests complete.
95+
"""
96+
# Reconnect signals - Django will automatically re-register the handlers
97+
importlib.reload(handlers)
98+
super().tearDown()
99+
84100
def _setup_test_configs_for_run_checks(self):
85101
"""
86102
Helper method to create SAML configurations for run-checks tests.

common/djangoapps/third_party_auth/signals/tests/test_handlers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import ddt
66
from unittest import mock
77
from unittest.mock import call
8-
from django.test import TestCase, override_settings
8+
from django.test import TestCase
99
from django.contrib.sites.models import Site
1010
from common.djangoapps.third_party_auth.tests.factories import SAMLConfigurationFactory, SAMLProviderConfigFactory
1111
from common.djangoapps.third_party_auth.models import SAMLProviderConfig

common/djangoapps/third_party_auth/toggles.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Togglable settings for Third Party Auth
33
"""
44

5-
from edx_toggles.toggles import WaffleFlag, SettingToggle
5+
from edx_toggles.toggles import WaffleFlag
66

77
THIRD_PARTY_AUTH_NAMESPACE = 'thirdpartyauth'
88

0 commit comments

Comments
 (0)