Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use tahoe-idp 2.4.2 #1348

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions openedx/core/djangoapps/appsembler/tahoe_idp/tests/patches.py
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from django.urls import reverse
from django.contrib.auth import get_user_model

from rest_framework.test import APITestCase
from rest_framework import status

Expand All @@ -18,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")
Expand Down Expand Up @@ -64,6 +67,7 @@ def deactivate_user(self, color, username=None):
})
return response

@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})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
from student.models import PendingEmailChange
from student.tests.factories import PendingEmailChangeFactory, UserFactory

from . import patches


@skip_unless_lms
class EmailChangeWithIdpTests(TestCase):
Expand All @@ -37,11 +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.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):
"""
Test `confirm_email_change` with ENABLE_TAHOE_IDP = True.
"""

with patch.dict(settings.FEATURES, {'ENABLE_TAHOE_IDP': True}):
response = self.client.get(reverse('confirm_email_change', args=[self.key]))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@

from student.tests.factories import UserFactory

from . import patches


@ddt.ddt
@skip_unless_lms
@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):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

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'


Expand Down Expand Up @@ -51,6 +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_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'),
Expand All @@ -60,6 +63,7 @@ def test_api_wit_tahoe_idp(self, url):
"""
Both v1 and v2 API shouldn't work with Tahoe IdP.
"""

color1 = 'red1'
with with_organization_context(site_color=color1):
response = self.register_user(url, 'red_learner')
Expand Down
2 changes: 1 addition & 1 deletion requirements/edx/appsembler.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down