From 20bac3a99fe18948b1e9cc49485209f331afe3f9 Mon Sep 17 00:00:00 2001 From: Bryan Wilson Date: Mon, 26 Jun 2023 11:16:44 -0700 Subject: [PATCH 01/15] use tahoe-idp 2.4.2 Syncs first, last, full names back to IdP --- requirements/edx/appsembler.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/edx/appsembler.txt b/requirements/edx/appsembler.txt index acbbe794624c..0e9e6e6d0682 100644 --- a/requirements/edx/appsembler.txt +++ b/requirements/edx/appsembler.txt @@ -23,7 +23,7 @@ https://github.com/appsembler/edx-proctoring/archive/v2.4.0-appsembler1.tar.gz django-tiers==0.2.7 fusionauth-client==1.36.0 google-cloud-storage==1.32.0 -tahoe-idp==2.3.0 +tahoe-idp==2.4.2 tahoe-sites==1.3.2 tahoe-lti==0.3.0 site-configuration-client==0.2.3 From 27ca3a8f90b003add0016af0baa1219ebc1bed9f Mon Sep 17 00:00:00 2001 From: Bryan Wilson Date: Mon, 26 Jun 2023 18:22:37 -0700 Subject: [PATCH 02/15] Fake TAHOE_IDP_CONFIGS in tests that will trigger tahoe-idp idp user sync receiver --- .../tahoe_idp/tests/test_tahoe_idp_account_deletion.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_account_deletion.py b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_account_deletion.py index 513cf3169fa4..7e0aacea2ff4 100644 --- a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_account_deletion.py +++ b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_account_deletion.py @@ -8,6 +8,7 @@ from django.urls import reverse from django.contrib.auth import get_user_model +from django.test import override_settings from rest_framework.test import APITestCase from rest_framework import status @@ -67,6 +68,7 @@ def deactivate_user(self, color, username=None): @patch('tahoe_idp.api.get_tahoe_idp_id_by_user') @patch('tahoe_idp.api.deactivate_user') @patch.dict('django.conf.settings.FEATURES', {'ENABLE_TAHOE_IDP': True}) + @override_settings(TAHOE_IDP_CONFIGS={'API_KEY':'fake', 'BASE_URL': 'http://localhost'}) def test_disallow_email_reuse_after_deactivate( self, mock_deactivate_user, mock_get_tahoe_idp_id_by_user ): From b0b1ccba935cd3ed211b63b915ccfcb8b0f2a212 Mon Sep 17 00:00:00 2001 From: Bryan Wilson Date: Tue, 27 Jun 2023 12:12:14 -0700 Subject: [PATCH 03/15] mock the TAHOE_IDP_CONFIGS settings in tahoe_idp app test cases that save a User --- .../tahoe_idp/tests/test_tahoe_idp_reset_password.py | 3 ++- .../appsembler/tahoe_idp/tests/test_tahoe_registration_api.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_reset_password.py b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_reset_password.py index b2ab7fe5264d..de0f26798dff 100644 --- a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_reset_password.py +++ b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_reset_password.py @@ -6,7 +6,7 @@ from django.conf import settings from django.core import mail -from django.test import RequestFactory, TestCase +from django.test import override_settings, RequestFactory, TestCase from unittest.mock import Mock, patch from openedx.core.djangoapps.user_authn.views.password_reset import password_reset from openedx.core.djangolib.testing.utils import skip_unless_lms @@ -23,6 +23,7 @@ class TahoeIdpResetPasswordTests(TestCase): """ request_factory = RequestFactory() + @override_settings(TAHOE_IDP_CONFIGS={'API_KEY':'fake', 'BASE_URL': 'http://localhost'}) @ddt.unpack @ddt.data({ 'enable_tahoe_idp': False, diff --git a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_registration_api.py b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_registration_api.py index 4cabca20b698..cb16f6607673 100644 --- a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_registration_api.py +++ b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_registration_api.py @@ -4,6 +4,7 @@ import ddt from mock import patch +from django.test import override_settings from django.urls import reverse_lazy from rest_framework import status from rest_framework.test import APITestCase @@ -51,6 +52,7 @@ def test_api_without_tahoe_idp(self, url): content = response.content.decode('utf-8') assert response.status_code == status.HTTP_200_OK, '{} {}'.format(color1, content) + @override_settings(TAHOE_IDP_CONFIGS={'API_KEY':'fake', 'BASE_URL': 'http://localhost'}) @patch.dict('django.conf.settings.FEATURES', {'ENABLE_TAHOE_IDP': True}) @ddt.data( reverse_lazy('tahoe-api:v1:registrations-list'), From 1467fe73c7d0bb468058e91748794c1f2f187ff1 Mon Sep 17 00:00:00 2001 From: Bryan Wilson Date: Tue, 27 Jun 2023 12:15:54 -0700 Subject: [PATCH 04/15] README for tahoe_idp tests --- openedx/core/djangoapps/appsembler/tahoe_idp/tests/README.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 openedx/core/djangoapps/appsembler/tahoe_idp/tests/README.md diff --git a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/README.md b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/README.md new file mode 100644 index 000000000000..dd243bf5c984 --- /dev/null +++ b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/README.md @@ -0,0 +1,5 @@ +Tests which rely on ENABLE_TAHOE_IDP: True and which cause a User or UserProfile to be saved +will need to also use: + @override_settings(TAHOE_IDP_CONFIGS={'API_KEY':'fake', 'BASE_URL': 'http://localhost'}) + (or in a context manager) +due to the post_save Signal receivers in tahoe-idp package. From 1910b2e15728dc92cd5c52569f5643f23781fe7f Mon Sep 17 00:00:00 2001 From: Bryan Wilson Date: Tue, 27 Jun 2023 12:28:22 -0700 Subject: [PATCH 05/15] missed another tahoe_idp test that needed TAHOE_IDP_CONFIGS --- .../appsembler/tahoe_idp/tests/test_tahoe_idp_email_change.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_email_change.py b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_email_change.py index a240b4db7f32..a341cb768e9d 100644 --- a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_email_change.py +++ b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_email_change.py @@ -4,7 +4,7 @@ from django.conf import settings from django.core import mail -from django.test import TestCase +from django.test import override_settings, TestCase from django.urls import reverse from unittest.mock import patch @@ -37,6 +37,7 @@ def test_successful_email_change_without_idp(self, mock_update_user_email): 'Should not use idp unless explicitly enabled via ENABLE_TAHOE_IDP' ) + @override_settings(TAHOE_IDP_CONFIGS={'API_KEY':'fake', 'BASE_URL': 'http://localhost'}) @patch('tahoe_idp.api.update_user_email') def test_successful_email_change_with_idp(self, mock_update_user_email): """ From a231332acd927c942174ab7c863e3d2526510340 Mon Sep 17 00:00:00 2001 From: Bryan Wilson Date: Tue, 27 Jun 2023 13:06:12 -0700 Subject: [PATCH 06/15] Rework handling tahoe_dip user_sync receiver in tests Just patch with a no-op --- .../core/djangoapps/appsembler/tahoe_idp/tests/README.md | 5 ----- .../tahoe_idp/tests/test_tahoe_idp_account_deletion.py | 5 ++--- .../tahoe_idp/tests/test_tahoe_idp_reset_password.py | 6 +++--- .../tahoe_idp/tests/test_tahoe_registration_api.py | 5 ++--- 4 files changed, 7 insertions(+), 14 deletions(-) delete mode 100644 openedx/core/djangoapps/appsembler/tahoe_idp/tests/README.md diff --git a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/README.md b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/README.md deleted file mode 100644 index dd243bf5c984..000000000000 --- a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/README.md +++ /dev/null @@ -1,5 +0,0 @@ -Tests which rely on ENABLE_TAHOE_IDP: True and which cause a User or UserProfile to be saved -will need to also use: - @override_settings(TAHOE_IDP_CONFIGS={'API_KEY':'fake', 'BASE_URL': 'http://localhost'}) - (or in a context manager) -due to the post_save Signal receivers in tahoe-idp package. diff --git a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_account_deletion.py b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_account_deletion.py index 7e0aacea2ff4..e97d242a2352 100644 --- a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_account_deletion.py +++ b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_account_deletion.py @@ -8,7 +8,6 @@ from django.urls import reverse from django.contrib.auth import get_user_model -from django.test import override_settings from rest_framework.test import APITestCase from rest_framework import status @@ -65,12 +64,12 @@ def deactivate_user(self, color, username=None): }) return response + @patch('tahoe_idp.receivers.user_sync_to_idp') # no-op @patch('tahoe_idp.api.get_tahoe_idp_id_by_user') @patch('tahoe_idp.api.deactivate_user') @patch.dict('django.conf.settings.FEATURES', {'ENABLE_TAHOE_IDP': True}) - @override_settings(TAHOE_IDP_CONFIGS={'API_KEY':'fake', 'BASE_URL': 'http://localhost'}) def test_disallow_email_reuse_after_deactivate( - self, mock_deactivate_user, mock_get_tahoe_idp_id_by_user + self, mock_deactivate_user, mock_get_tahoe_idp_id_by_user, mock_user_sync_to_idp ): """ Test the account deletion with Tahoe IdP support. diff --git a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_reset_password.py b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_reset_password.py index de0f26798dff..54481de702fe 100644 --- a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_reset_password.py +++ b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_reset_password.py @@ -6,7 +6,7 @@ from django.conf import settings from django.core import mail -from django.test import override_settings, RequestFactory, TestCase +from django.test import RequestFactory, TestCase from unittest.mock import Mock, patch from openedx.core.djangoapps.user_authn.views.password_reset import password_reset from openedx.core.djangolib.testing.utils import skip_unless_lms @@ -16,6 +16,7 @@ @ddt.ddt @skip_unless_lms +@patch('tahoe_idp.receivers.user_sync_to_idp') # no-op @patch('tahoe_idp.api.request_password_reset') class TahoeIdpResetPasswordTests(TestCase): """ @@ -23,7 +24,6 @@ class TahoeIdpResetPasswordTests(TestCase): """ request_factory = RequestFactory() - @override_settings(TAHOE_IDP_CONFIGS={'API_KEY':'fake', 'BASE_URL': 'http://localhost'}) @ddt.unpack @ddt.data({ 'enable_tahoe_idp': False, @@ -32,7 +32,7 @@ class TahoeIdpResetPasswordTests(TestCase): 'enable_tahoe_idp': True, 'message': 'Tahoe 2.0 logic: should NOT send email via Open edX, `tahoe_idp` takes care of that', }) - def test_reset_password_with_tahoe_idp(self, mock_request_password_reset, enable_tahoe_idp, message): + def test_reset_password_with_tahoe_idp(self, mock_request_password_reset, mock_user_sync_to_idp, enable_tahoe_idp, message): """ Tests Tahoe IdP/non-idp password reset. """ diff --git a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_registration_api.py b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_registration_api.py index cb16f6607673..b41f19c4580f 100644 --- a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_registration_api.py +++ b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_registration_api.py @@ -4,7 +4,6 @@ import ddt from mock import patch -from django.test import override_settings from django.urls import reverse_lazy from rest_framework import status from rest_framework.test import APITestCase @@ -52,13 +51,13 @@ def test_api_without_tahoe_idp(self, url): content = response.content.decode('utf-8') assert response.status_code == status.HTTP_200_OK, '{} {}'.format(color1, content) - @override_settings(TAHOE_IDP_CONFIGS={'API_KEY':'fake', 'BASE_URL': 'http://localhost'}) + @patch('tahoe_idp.receivers.user_sync_to_idp') # no-op @patch.dict('django.conf.settings.FEATURES', {'ENABLE_TAHOE_IDP': True}) @ddt.data( reverse_lazy('tahoe-api:v1:registrations-list'), reverse_lazy('tahoe-api:v2:registrations-list'), ) - def test_api_wit_tahoe_idp(self, url): + def test_api_wit_tahoe_idp(self, mock_user_sync_to_idp, url): """ Both v1 and v2 API shouldn't work with Tahoe IdP. """ From ee68b8f656198b0c39094fb4ca614d78d62c81a7 Mon Sep 17 00:00:00 2001 From: Bryan Wilson Date: Tue, 27 Jun 2023 16:28:48 -0700 Subject: [PATCH 07/15] Try again to connect the mock tahoe-idp user sync receivers for tests --- .../tahoe_idp/tests/test_tahoe_idp_account_deletion.py | 7 ++++++- .../tahoe_idp/tests/test_tahoe_idp_reset_password.py | 6 ++++++ .../tahoe_idp/tests/test_tahoe_registration_api.py | 5 +++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_account_deletion.py b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_account_deletion.py index e97d242a2352..197e9cf6aa52 100644 --- a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_account_deletion.py +++ b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_account_deletion.py @@ -6,6 +6,7 @@ import pytest from social_django.models import UserSocialAuth +from django.db.models.signals import post_save from django.urls import reverse from django.contrib.auth import get_user_model from rest_framework.test import APITestCase @@ -64,7 +65,7 @@ def deactivate_user(self, color, username=None): }) return response - @patch('tahoe_idp.receivers.user_sync_to_idp') # no-op + @patch('tahoe_idp.receivers.user_sync_to_idp') @patch('tahoe_idp.api.get_tahoe_idp_id_by_user') @patch('tahoe_idp.api.deactivate_user') @patch.dict('django.conf.settings.FEATURES', {'ENABLE_TAHOE_IDP': True}) @@ -77,6 +78,10 @@ def test_disallow_email_reuse_after_deactivate( social_auth_uid = 'e1ede4d8-f6f6-11ec-9eb7-f778f1c67e22' mock_get_tahoe_idp_id_by_user.return_value = social_auth_uid + # mock out receivers which rely on a real Tenant Id + post_save.connect(mock_user_sync_to_idp, sender=User, dispatch_uid='tahoe_idp.receivers.user_sync_to_idp') + post_save.connect(mock_user_sync_to_idp, sender=UserProfile, dispatch_uid='tahoe_idp.receivers.user_sync_to_idp') + with with_organization_context(site_color=self.RED): register_res = self.register_user(self.RED) assert register_res.status_code == status.HTTP_200_OK, register_res.content.decode('utf-8') diff --git a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_reset_password.py b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_reset_password.py index 54481de702fe..4a0593a0363b 100644 --- a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_reset_password.py +++ b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_reset_password.py @@ -6,6 +6,7 @@ from django.conf import settings from django.core import mail +from django.db.models.signals import post_save from django.test import RequestFactory, TestCase from unittest.mock import Mock, patch from openedx.core.djangoapps.user_authn.views.password_reset import password_reset @@ -42,6 +43,11 @@ def test_reset_password_with_tahoe_idp(self, mock_request_password_reset, mock_u req.site = Mock(domain='example.com') req.user = user + # mock out receivers which rely on a real Tenant Id + post_save.connect(mock_user_sync_to_idp, sender=User, dispatch_uid='tahoe_idp.receivers.user_sync_to_idp') + post_save.connect(mock_user_sync_to_idp, sender=UserProfile, dispatch_uid='tahoe_idp.receivers.user_sync_to_idp') + + with patch.dict(settings.FEATURES, {'ENABLE_TAHOE_IDP': enable_tahoe_idp}): with patch('crum.get_current_request', return_value=req): response = password_reset(req) diff --git a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_registration_api.py b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_registration_api.py index b41f19c4580f..40358b17632b 100644 --- a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_registration_api.py +++ b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_registration_api.py @@ -4,6 +4,7 @@ import ddt from mock import patch +from django.db.models.signals import post_save from django.urls import reverse_lazy from rest_framework import status from rest_framework.test import APITestCase @@ -61,6 +62,10 @@ def test_api_wit_tahoe_idp(self, mock_user_sync_to_idp, url): """ Both v1 and v2 API shouldn't work with Tahoe IdP. """ + + post_save.connect(mock_user_sync_to_idp, sender=User, dispatch_uid='tahoe_idp.receivers.user_sync_to_idp') + post_save.connect(mock_user_sync_to_idp, sender=UserProfile, dispatch_uid='tahoe_idp.receivers.user_sync_to_idp') + color1 = 'red1' with with_organization_context(site_color=color1): response = self.register_user(url, 'red_learner') From 0de5fe1e6382203e1c7ffa512d1527e8fe9a4ca7 Mon Sep 17 00:00:00 2001 From: Bryan Wilson Date: Tue, 27 Jun 2023 16:42:19 -0700 Subject: [PATCH 08/15] import fixes for the tahoe-idp receivers mocks --- .../tahoe_idp/tests/test_tahoe_idp_account_deletion.py | 4 ++++ .../tahoe_idp/tests/test_tahoe_idp_reset_password.py | 2 ++ .../appsembler/tahoe_idp/tests/test_tahoe_registration_api.py | 2 ++ 3 files changed, 8 insertions(+) diff --git a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_account_deletion.py b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_account_deletion.py index 197e9cf6aa52..23f4a5f292ae 100644 --- a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_account_deletion.py +++ b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_account_deletion.py @@ -9,9 +9,13 @@ from django.db.models.signals import post_save from django.urls import reverse from django.contrib.auth import get_user_model +from django.contrib.auth.models import User + from rest_framework.test import APITestCase from rest_framework import status +from student.models import UserProfile + from ...multi_tenant_emails.tests.test_utils import with_organization_context from openedx.core.djangoapps.user_api.accounts.tests.retirement_helpers import ( diff --git a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_reset_password.py b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_reset_password.py index 4a0593a0363b..253b4b534629 100644 --- a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_reset_password.py +++ b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_reset_password.py @@ -5,6 +5,7 @@ import ddt from django.conf import settings +from django.contrib.auth.models import User from django.core import mail from django.db.models.signals import post_save from django.test import RequestFactory, TestCase @@ -12,6 +13,7 @@ from openedx.core.djangoapps.user_authn.views.password_reset import password_reset from openedx.core.djangolib.testing.utils import skip_unless_lms +from student.models import UserProfile from student.tests.factories import UserFactory diff --git a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_registration_api.py b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_registration_api.py index 40358b17632b..937f032ddf57 100644 --- a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_registration_api.py +++ b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_registration_api.py @@ -4,12 +4,14 @@ import ddt from mock import patch +from django.contrib.auth.models import User from django.db.models.signals import post_save from django.urls import reverse_lazy from rest_framework import status from rest_framework.test import APITestCase from openedx.core.djangolib.testing.utils import skip_unless_lms +from student.models import User from ...multi_tenant_emails.tests.test_utils import with_organization_context From c7f6385d6cbc55f9c93f939206ff8bc8cad1e270 Mon Sep 17 00:00:00 2001 From: Bryan Wilson Date: Tue, 27 Jun 2023 16:43:53 -0700 Subject: [PATCH 09/15] oops on the import --- .../appsembler/tahoe_idp/tests/test_tahoe_registration_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_registration_api.py b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_registration_api.py index 937f032ddf57..63b6e770227b 100644 --- a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_registration_api.py +++ b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_registration_api.py @@ -11,7 +11,7 @@ from rest_framework.test import APITestCase from openedx.core.djangolib.testing.utils import skip_unless_lms -from student.models import User +from student.models import UserProfile from ...multi_tenant_emails.tests.test_utils import with_organization_context From 55be3ff4318c90e44215ee3852f6a3466b0b968e Mon Sep 17 00:00:00 2001 From: Bryan Wilson Date: Tue, 27 Jun 2023 16:51:22 -0700 Subject: [PATCH 10/15] mock user_sync_to_idp receiver in tahoe idp email change tests --- .../tahoe_idp/tests/test_tahoe_idp_email_change.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_email_change.py b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_email_change.py index a341cb768e9d..8dd1d3af341d 100644 --- a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_email_change.py +++ b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_email_change.py @@ -3,13 +3,15 @@ """ from django.conf import settings +from django.contrib.auth.models import User from django.core import mail -from django.test import override_settings, TestCase +from django.db.models.signals import post_save +from django.test import TestCase from django.urls import reverse from unittest.mock import patch from openedx.core.djangolib.testing.utils import skip_unless_lms -from student.models import PendingEmailChange +from student.models import PendingEmailChange, UserProfile from student.tests.factories import PendingEmailChangeFactory, UserFactory @@ -37,12 +39,15 @@ def test_successful_email_change_without_idp(self, mock_update_user_email): 'Should not use idp unless explicitly enabled via ENABLE_TAHOE_IDP' ) - @override_settings(TAHOE_IDP_CONFIGS={'API_KEY':'fake', 'BASE_URL': 'http://localhost'}) @patch('tahoe_idp.api.update_user_email') - def test_successful_email_change_with_idp(self, mock_update_user_email): + def test_successful_email_change_with_idp(self, mock_update_user_email, mock_user_sync_to_idp): """ Test `confirm_email_change` with ENABLE_TAHOE_IDP = True. """ + + post_save.connect(mock_user_sync_to_idp, sender=User, dispatch_uid='tahoe_idp.receivers.user_sync_to_idp') + post_save.connect(mock_user_sync_to_idp, sender=UserProfile, dispatch_uid='tahoe_idp.receivers.user_sync_to_idp') + with patch.dict(settings.FEATURES, {'ENABLE_TAHOE_IDP': True}): response = self.client.get(reverse('confirm_email_change', args=[self.key])) From 3d14bccf7f9ecfe6b252bd69428f2f405e5ad29f Mon Sep 17 00:00:00 2001 From: Bryan Wilson Date: Tue, 27 Jun 2023 16:53:40 -0700 Subject: [PATCH 11/15] fix test decorator --- .../appsembler/tahoe_idp/tests/test_tahoe_idp_email_change.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_email_change.py b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_email_change.py index 8dd1d3af341d..5d36b9669cc6 100644 --- a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_email_change.py +++ b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_email_change.py @@ -39,6 +39,7 @@ def test_successful_email_change_without_idp(self, mock_update_user_email): 'Should not use idp unless explicitly enabled via ENABLE_TAHOE_IDP' ) + @patch('tahoe_idp.receivers.user_sync_to_idp') @patch('tahoe_idp.api.update_user_email') def test_successful_email_change_with_idp(self, mock_update_user_email, mock_user_sync_to_idp): """ From 9113129a8715e9b4e7cb8c8817eddc05cdfe4e7b Mon Sep 17 00:00:00 2001 From: Bryan Wilson Date: Wed, 28 Jun 2023 11:35:47 -0700 Subject: [PATCH 12/15] rework mocking of tahoe-idp receiver is_idp_enabled check in tests --- .../tests/test_tahoe_idp_account_deletion.py | 14 ++++---------- .../tahoe_idp/tests/test_tahoe_idp_email_change.py | 13 +++++-------- .../tests/test_tahoe_idp_reset_password.py | 14 ++++---------- .../tahoe_idp/tests/test_tahoe_registration_api.py | 12 ++++-------- 4 files changed, 17 insertions(+), 36 deletions(-) diff --git a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_account_deletion.py b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_account_deletion.py index 23f4a5f292ae..fcc51141fe34 100644 --- a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_account_deletion.py +++ b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_account_deletion.py @@ -6,16 +6,12 @@ import pytest from social_django.models import UserSocialAuth -from django.db.models.signals import post_save from django.urls import reverse from django.contrib.auth import get_user_model -from django.contrib.auth.models import User from rest_framework.test import APITestCase from rest_framework import status -from student.models import UserProfile - from ...multi_tenant_emails.tests.test_utils import with_organization_context from openedx.core.djangoapps.user_api.accounts.tests.retirement_helpers import ( @@ -23,6 +19,8 @@ setup_retirement_states, # pylint: disable=unused-import ) +from . import patches + @patch.dict('django.conf.settings.FEATURES', {'SKIP_EMAIL_VALIDATION': True}) @pytest.mark.usefixtures("setup_retirement_states") @@ -69,12 +67,12 @@ def deactivate_user(self, color, username=None): }) return response - @patch('tahoe_idp.receivers.user_sync_to_idp') + @patch('tahoe_idp.receivers.helpers.is_idp_enabled', new=patches.dummy_receivers_idp_not_enabled) @patch('tahoe_idp.api.get_tahoe_idp_id_by_user') @patch('tahoe_idp.api.deactivate_user') @patch.dict('django.conf.settings.FEATURES', {'ENABLE_TAHOE_IDP': True}) def test_disallow_email_reuse_after_deactivate( - self, mock_deactivate_user, mock_get_tahoe_idp_id_by_user, mock_user_sync_to_idp + self, mock_deactivate_user, mock_get_tahoe_idp_id_by_user, mock_receivers_is_idp_enabled ): """ Test the account deletion with Tahoe IdP support. @@ -82,10 +80,6 @@ def test_disallow_email_reuse_after_deactivate( social_auth_uid = 'e1ede4d8-f6f6-11ec-9eb7-f778f1c67e22' mock_get_tahoe_idp_id_by_user.return_value = social_auth_uid - # mock out receivers which rely on a real Tenant Id - post_save.connect(mock_user_sync_to_idp, sender=User, dispatch_uid='tahoe_idp.receivers.user_sync_to_idp') - post_save.connect(mock_user_sync_to_idp, sender=UserProfile, dispatch_uid='tahoe_idp.receivers.user_sync_to_idp') - with with_organization_context(site_color=self.RED): register_res = self.register_user(self.RED) assert register_res.status_code == status.HTTP_200_OK, register_res.content.decode('utf-8') diff --git a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_email_change.py b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_email_change.py index 5d36b9669cc6..c6bb321361db 100644 --- a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_email_change.py +++ b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_email_change.py @@ -3,17 +3,17 @@ """ from django.conf import settings -from django.contrib.auth.models import User from django.core import mail -from django.db.models.signals import post_save from django.test import TestCase from django.urls import reverse from unittest.mock import patch from openedx.core.djangolib.testing.utils import skip_unless_lms -from student.models import PendingEmailChange, UserProfile +from student.models import PendingEmailChange from student.tests.factories import PendingEmailChangeFactory, UserFactory +from . import patches + @skip_unless_lms class EmailChangeWithIdpTests(TestCase): @@ -39,16 +39,13 @@ def test_successful_email_change_without_idp(self, mock_update_user_email): 'Should not use idp unless explicitly enabled via ENABLE_TAHOE_IDP' ) - @patch('tahoe_idp.receivers.user_sync_to_idp') + @patch('tahoe_idp.receivers.helpers.is_idp_enabled', new=patches.dummy_receivers_idp_not_enabled) @patch('tahoe_idp.api.update_user_email') - def test_successful_email_change_with_idp(self, mock_update_user_email, mock_user_sync_to_idp): + def test_successful_email_change_with_idp(self, mock_update_user_email, mock_receivers_is_idp_enabled): """ Test `confirm_email_change` with ENABLE_TAHOE_IDP = True. """ - post_save.connect(mock_user_sync_to_idp, sender=User, dispatch_uid='tahoe_idp.receivers.user_sync_to_idp') - post_save.connect(mock_user_sync_to_idp, sender=UserProfile, dispatch_uid='tahoe_idp.receivers.user_sync_to_idp') - with patch.dict(settings.FEATURES, {'ENABLE_TAHOE_IDP': True}): response = self.client.get(reverse('confirm_email_change', args=[self.key])) diff --git a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_reset_password.py b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_reset_password.py index 253b4b534629..cf21fc78b308 100644 --- a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_reset_password.py +++ b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_reset_password.py @@ -5,21 +5,20 @@ import ddt from django.conf import settings -from django.contrib.auth.models import User from django.core import mail -from django.db.models.signals import post_save from django.test import RequestFactory, TestCase from unittest.mock import Mock, patch from openedx.core.djangoapps.user_authn.views.password_reset import password_reset from openedx.core.djangolib.testing.utils import skip_unless_lms -from student.models import UserProfile from student.tests.factories import UserFactory +from . import patches + @ddt.ddt @skip_unless_lms -@patch('tahoe_idp.receivers.user_sync_to_idp') # no-op +@patch('tahoe_idp.receivers.helpers.is_idp_enabled', new=patches.dummy_receivers_idp_not_enabled) @patch('tahoe_idp.api.request_password_reset') class TahoeIdpResetPasswordTests(TestCase): """ @@ -35,7 +34,7 @@ class TahoeIdpResetPasswordTests(TestCase): 'enable_tahoe_idp': True, 'message': 'Tahoe 2.0 logic: should NOT send email via Open edX, `tahoe_idp` takes care of that', }) - def test_reset_password_with_tahoe_idp(self, mock_request_password_reset, mock_user_sync_to_idp, enable_tahoe_idp, message): + def test_reset_password_with_tahoe_idp(self, mock_request_password_reset, mock_receivers_is_idp_enabled, enable_tahoe_idp, message): """ Tests Tahoe IdP/non-idp password reset. """ @@ -45,11 +44,6 @@ def test_reset_password_with_tahoe_idp(self, mock_request_password_reset, mock_u req.site = Mock(domain='example.com') req.user = user - # mock out receivers which rely on a real Tenant Id - post_save.connect(mock_user_sync_to_idp, sender=User, dispatch_uid='tahoe_idp.receivers.user_sync_to_idp') - post_save.connect(mock_user_sync_to_idp, sender=UserProfile, dispatch_uid='tahoe_idp.receivers.user_sync_to_idp') - - with patch.dict(settings.FEATURES, {'ENABLE_TAHOE_IDP': enable_tahoe_idp}): with patch('crum.get_current_request', return_value=req): response = password_reset(req) diff --git a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_registration_api.py b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_registration_api.py index 63b6e770227b..d770d4515715 100644 --- a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_registration_api.py +++ b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_registration_api.py @@ -4,17 +4,16 @@ import ddt from mock import patch -from django.contrib.auth.models import User -from django.db.models.signals import post_save from django.urls import reverse_lazy from rest_framework import status from rest_framework.test import APITestCase from openedx.core.djangolib.testing.utils import skip_unless_lms -from student.models import UserProfile from ...multi_tenant_emails.tests.test_utils import with_organization_context +from . import patches + APPSEMBLER_API_VIEWS_MODULE = 'openedx.core.djangoapps.appsembler.api.v1.views' @@ -54,20 +53,17 @@ def test_api_without_tahoe_idp(self, url): content = response.content.decode('utf-8') assert response.status_code == status.HTTP_200_OK, '{} {}'.format(color1, content) - @patch('tahoe_idp.receivers.user_sync_to_idp') # no-op + @patch('tahoe_idp.receivers.helpers.is_idp_enabled', new=patches.dummy_receivers_idp_not_enabled) @patch.dict('django.conf.settings.FEATURES', {'ENABLE_TAHOE_IDP': True}) @ddt.data( reverse_lazy('tahoe-api:v1:registrations-list'), reverse_lazy('tahoe-api:v2:registrations-list'), ) - def test_api_wit_tahoe_idp(self, mock_user_sync_to_idp, url): + def test_api_wit_tahoe_idp(self, mock_receivers_is_idp_enabled, url): """ Both v1 and v2 API shouldn't work with Tahoe IdP. """ - post_save.connect(mock_user_sync_to_idp, sender=User, dispatch_uid='tahoe_idp.receivers.user_sync_to_idp') - post_save.connect(mock_user_sync_to_idp, sender=UserProfile, dispatch_uid='tahoe_idp.receivers.user_sync_to_idp') - color1 = 'red1' with with_organization_context(site_color=color1): response = self.register_user(url, 'red_learner') From 481258dcd52ba61354d62895b9d688241ca367b2 Mon Sep 17 00:00:00 2001 From: Bryan Wilson Date: Wed, 28 Jun 2023 12:00:35 -0700 Subject: [PATCH 13/15] Forgot to commit new patches module --- .../djangoapps/appsembler/tahoe_idp/tests/patches.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 openedx/core/djangoapps/appsembler/tahoe_idp/tests/patches.py diff --git a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/patches.py b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/patches.py new file mode 100644 index 000000000000..0fd4d15f2b20 --- /dev/null +++ b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/patches.py @@ -0,0 +1,10 @@ +""" +patching helpers +""" + +from mock import Mock + + +# Keep Signal receivers in tahoe_idp from executing fully when not explicitly testing +dummy_receivers_idp_not_enabled = Mock() +dummy_receivers_idp_not_enabled.return_value = False From 131b0121a6d088b14ef928901fb09a19780e46ba Mon Sep 17 00:00:00 2001 From: Bryan Wilson Date: Wed, 28 Jun 2023 12:03:02 -0700 Subject: [PATCH 14/15] got the patch path wrong --- .../tahoe_idp/tests/test_tahoe_idp_account_deletion.py | 2 +- .../appsembler/tahoe_idp/tests/test_tahoe_idp_email_change.py | 2 +- .../appsembler/tahoe_idp/tests/test_tahoe_idp_reset_password.py | 2 +- .../appsembler/tahoe_idp/tests/test_tahoe_registration_api.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_account_deletion.py b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_account_deletion.py index fcc51141fe34..54cc4413a80d 100644 --- a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_account_deletion.py +++ b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_account_deletion.py @@ -67,7 +67,7 @@ def deactivate_user(self, color, username=None): }) return response - @patch('tahoe_idp.receivers.helpers.is_idp_enabled', new=patches.dummy_receivers_idp_not_enabled) + @patch('tahoe_idp.receivers.helpers.is_tahoe_idp_enabled', new=patches.dummy_receivers_idp_not_enabled) @patch('tahoe_idp.api.get_tahoe_idp_id_by_user') @patch('tahoe_idp.api.deactivate_user') @patch.dict('django.conf.settings.FEATURES', {'ENABLE_TAHOE_IDP': True}) diff --git a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_email_change.py b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_email_change.py index c6bb321361db..c05c886aeb99 100644 --- a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_email_change.py +++ b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_email_change.py @@ -39,7 +39,7 @@ def test_successful_email_change_without_idp(self, mock_update_user_email): 'Should not use idp unless explicitly enabled via ENABLE_TAHOE_IDP' ) - @patch('tahoe_idp.receivers.helpers.is_idp_enabled', new=patches.dummy_receivers_idp_not_enabled) + @patch('tahoe_idp.receivers.helpers.is_tahoe_idp_enabled', new=patches.dummy_receivers_idp_not_enabled) @patch('tahoe_idp.api.update_user_email') def test_successful_email_change_with_idp(self, mock_update_user_email, mock_receivers_is_idp_enabled): """ diff --git a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_reset_password.py b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_reset_password.py index cf21fc78b308..6e5162580664 100644 --- a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_reset_password.py +++ b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_reset_password.py @@ -18,7 +18,7 @@ @ddt.ddt @skip_unless_lms -@patch('tahoe_idp.receivers.helpers.is_idp_enabled', new=patches.dummy_receivers_idp_not_enabled) +@patch('tahoe_idp.receivers.helpers.is_tahoe_idp_enabled', new=patches.dummy_receivers_idp_not_enabled) @patch('tahoe_idp.api.request_password_reset') class TahoeIdpResetPasswordTests(TestCase): """ diff --git a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_registration_api.py b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_registration_api.py index d770d4515715..d6cc34592c7a 100644 --- a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_registration_api.py +++ b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_registration_api.py @@ -53,7 +53,7 @@ def test_api_without_tahoe_idp(self, url): content = response.content.decode('utf-8') assert response.status_code == status.HTTP_200_OK, '{} {}'.format(color1, content) - @patch('tahoe_idp.receivers.helpers.is_idp_enabled', new=patches.dummy_receivers_idp_not_enabled) + @patch('tahoe_idp.receivers.helpers.is_tahoe_idp_enabled', new=patches.dummy_receivers_idp_not_enabled) @patch.dict('django.conf.settings.FEATURES', {'ENABLE_TAHOE_IDP': True}) @ddt.data( reverse_lazy('tahoe-api:v1:registrations-list'), From b8b12b116f0a8eb472096da3f1e58e4452dc5e25 Mon Sep 17 00:00:00 2001 From: Bryan Wilson Date: Wed, 28 Jun 2023 12:11:40 -0700 Subject: [PATCH 15/15] Fix tahoe-idp receiver func test mocking --- .../tahoe_idp/tests/test_tahoe_idp_account_deletion.py | 2 +- .../appsembler/tahoe_idp/tests/test_tahoe_idp_email_change.py | 2 +- .../appsembler/tahoe_idp/tests/test_tahoe_idp_reset_password.py | 2 +- .../appsembler/tahoe_idp/tests/test_tahoe_registration_api.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_account_deletion.py b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_account_deletion.py index 54cc4413a80d..80b50bcfdd50 100644 --- a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_account_deletion.py +++ b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_account_deletion.py @@ -72,7 +72,7 @@ def deactivate_user(self, color, username=None): @patch('tahoe_idp.api.deactivate_user') @patch.dict('django.conf.settings.FEATURES', {'ENABLE_TAHOE_IDP': True}) def test_disallow_email_reuse_after_deactivate( - self, mock_deactivate_user, mock_get_tahoe_idp_id_by_user, mock_receivers_is_idp_enabled + self, mock_deactivate_user, mock_get_tahoe_idp_id_by_user ): """ Test the account deletion with Tahoe IdP support. diff --git a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_email_change.py b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_email_change.py index c05c886aeb99..0228f3e47c79 100644 --- a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_email_change.py +++ b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_email_change.py @@ -41,7 +41,7 @@ def test_successful_email_change_without_idp(self, mock_update_user_email): @patch('tahoe_idp.receivers.helpers.is_tahoe_idp_enabled', new=patches.dummy_receivers_idp_not_enabled) @patch('tahoe_idp.api.update_user_email') - def test_successful_email_change_with_idp(self, mock_update_user_email, mock_receivers_is_idp_enabled): + def test_successful_email_change_with_idp(self, mock_update_user_email): """ Test `confirm_email_change` with ENABLE_TAHOE_IDP = True. """ diff --git a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_reset_password.py b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_reset_password.py index 6e5162580664..aedb06bd0a16 100644 --- a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_reset_password.py +++ b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_idp_reset_password.py @@ -34,7 +34,7 @@ class TahoeIdpResetPasswordTests(TestCase): 'enable_tahoe_idp': True, 'message': 'Tahoe 2.0 logic: should NOT send email via Open edX, `tahoe_idp` takes care of that', }) - def test_reset_password_with_tahoe_idp(self, mock_request_password_reset, mock_receivers_is_idp_enabled, enable_tahoe_idp, message): + def test_reset_password_with_tahoe_idp(self, mock_request_password_reset, enable_tahoe_idp, message): """ Tests Tahoe IdP/non-idp password reset. """ diff --git a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_registration_api.py b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_registration_api.py index d6cc34592c7a..9ad24c211019 100644 --- a/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_registration_api.py +++ b/openedx/core/djangoapps/appsembler/tahoe_idp/tests/test_tahoe_registration_api.py @@ -59,7 +59,7 @@ def test_api_without_tahoe_idp(self, url): reverse_lazy('tahoe-api:v1:registrations-list'), reverse_lazy('tahoe-api:v2:registrations-list'), ) - def test_api_wit_tahoe_idp(self, mock_receivers_is_idp_enabled, url): + def test_api_wit_tahoe_idp(self, url): """ Both v1 and v2 API shouldn't work with Tahoe IdP. """