test: Remove tests that rely on edx-name-affirmation service being installed
The service is specific to 2U and should not be installed by default. When we try to patch objects from that library, that can only be done if the original object is importable. So those tests don't make sense to have in the base system which you should be able to run without the edx-name-affirmation library.
This commit is contained in:
@@ -395,7 +395,8 @@ class TestAccountApi(UserSettingsEventTestMixin, EmailTemplateTagMixin, CreateAc
|
||||
updated_meta = user_profile.get_meta()
|
||||
self.assertEqual(meta, updated_meta)
|
||||
|
||||
@patch('edx_name_affirmation.name_change_validator.NameChangeValidator.validate', Mock(return_value=False))
|
||||
@patch('openedx.core.djangoapps.user_api.accounts.api._does_name_change_require_verification',
|
||||
Mock(return_value=True))
|
||||
@patch('openedx.core.djangoapps.user_api.accounts.api.get_certificates_for_user',
|
||||
Mock(return_value=[{'status': CertificateStatuses.downloadable}]))
|
||||
@patch('openedx.core.djangoapps.user_api.accounts.api.get_verified_enrollments',
|
||||
@@ -414,8 +415,6 @@ class TestAccountApi(UserSettingsEventTestMixin, EmailTemplateTagMixin, CreateAc
|
||||
account_settings = get_account_settings(self.default_request)[0]
|
||||
assert account_settings['name'] != 'New Name'
|
||||
|
||||
@patch('edx_name_affirmation.name_change_validator.NameChangeValidator', Mock())
|
||||
@patch('edx_name_affirmation.name_change_validator.NameChangeValidator.validate', Mock(return_value=True))
|
||||
@ddt.data(
|
||||
(True, False),
|
||||
(False, True),
|
||||
|
||||
@@ -6,7 +6,7 @@ from unittest.mock import patch
|
||||
import ddt
|
||||
from edx_django_utils.plugins import PluginError
|
||||
|
||||
from openedx.features.name_affirmation_api.utils import is_name_affirmation_installed, get_name_affirmation_service
|
||||
from openedx.features.name_affirmation_api.utils import is_name_affirmation_installed
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
@@ -23,14 +23,3 @@ class TestNameAffirmationAPIUtils(TestCase):
|
||||
mock_manager.side_effect = PluginError('No such plugin')
|
||||
with self.assertRaises(PluginError):
|
||||
self.assertFalse(is_name_affirmation_installed())
|
||||
|
||||
@patch('edx_name_affirmation.services.NameAffirmationService')
|
||||
@ddt.data(True, False)
|
||||
def test_get_name_affirmation_service(self, name_affirmation_installed, mock_service):
|
||||
with patch('openedx.features.name_affirmation_api.utils.is_name_affirmation_installed',
|
||||
return_value=name_affirmation_installed):
|
||||
name_affirmation_service = get_name_affirmation_service()
|
||||
if name_affirmation_installed:
|
||||
self.assertEqual(name_affirmation_service, mock_service())
|
||||
else:
|
||||
self.assertIsNone(name_affirmation_service)
|
||||
|
||||
Reference in New Issue
Block a user