diff --git a/acapy_agent/multitenant/admin/routes.py b/acapy_agent/multitenant/admin/routes.py index 3d03b6bf62..e0ddee87a1 100644 --- a/acapy_agent/multitenant/admin/routes.py +++ b/acapy_agent/multitenant/admin/routes.py @@ -24,7 +24,6 @@ from ...multitenant.base import BaseMultitenantManager from ...storage.error import StorageError, StorageNotFoundError from ...utils.endorsement_setup import attempt_auto_author_with_endorser_setup -from ...utils.profiles import subwallet_type_not_same_as_base_wallet_raise_web_exception from ...wallet.error import WalletSettingsError from ...wallet.models.wallet_record import WalletRecord, WalletRecordSchema from ..error import WalletKeyMissingError @@ -450,11 +449,6 @@ async def wallet_create(request: web.BaseRequest): base_wallet_type = context.profile.settings.get("wallet.type") sub_wallet_type = body.get("wallet_type", base_wallet_type) - - subwallet_type_not_same_as_base_wallet_raise_web_exception( - base_wallet_type, sub_wallet_type - ) - key_management_mode = body.get("key_management_mode") or WalletRecord.MODE_MANAGED wallet_key = body.get("wallet_key") wallet_webhook_urls = body.get("wallet_webhook_urls") or [] diff --git a/acapy_agent/multitenant/admin/tests/test_routes.py b/acapy_agent/multitenant/admin/tests/test_routes.py index 6f24c863de..44be267d40 100644 --- a/acapy_agent/multitenant/admin/tests/test_routes.py +++ b/acapy_agent/multitenant/admin/tests/test_routes.py @@ -215,56 +215,6 @@ async def test_wallet_create_tenant_settings(self): assert mock_multitenant_mgr.get_wallet_profile.called assert test_module.attempt_auto_author_with_endorser_setup.called - async def test_wallet_create_wallet_type_different_from_base_wallet_raises_403( - self, - ): - body = { - "wallet_name": "test", - "default_label": "test_label", - "wallet_type": "askar", - "wallet_key": "test", - "key_management_mode": "managed", - "wallet_webhook_urls": [], - "wallet_dispatch_type": "base", - } - wallet_mock = mock.MagicMock( - serialize=mock.MagicMock( - return_value={ - "wallet_id": "test", - "settings": {}, - "key_management_mode": body["key_management_mode"], - } - ) - ) - # wallet_record - mock_multitenant_mgr = mock.AsyncMock(BaseMultitenantManager, autospec=True) - mock_multitenant_mgr.create_wallet = mock.CoroutineMock(return_value=wallet_mock) - - mock_multitenant_mgr.create_auth_token = mock.CoroutineMock( - return_value="test_token" - ) - mock_multitenant_mgr.get_wallet_profile = mock.CoroutineMock( - return_value=mock.MagicMock() - ) - self.profile.context.injector.bind_instance( - BaseMultitenantManager, mock_multitenant_mgr - ) - self.request.json = mock.CoroutineMock(return_value=body) - - await test_module.wallet_create(self.request) - - body["wallet_type"] = "askar-anoncreds" - with self.assertRaises(test_module.web.HTTPForbidden): - await test_module.wallet_create(self.request) - - body["wallet_type"] = "indy" - with self.assertRaises(test_module.web.HTTPForbidden): - await test_module.wallet_create(self.request) - - body["wallet_type"] = "in_memory" - with self.assertRaises(test_module.web.HTTPForbidden): - await test_module.wallet_create(self.request) - async def test_wallet_create(self): body = { "wallet_name": "test", diff --git a/acapy_agent/utils/profiles.py b/acapy_agent/utils/profiles.py index 9fd888c3e4..f1afec248d 100644 --- a/acapy_agent/utils/profiles.py +++ b/acapy_agent/utils/profiles.py @@ -25,16 +25,6 @@ def is_not_anoncreds_profile_raise_web_exception(profile: Profile) -> None: raise web.HTTPForbidden(reason=ANONCREDS_PROFILE_REQUIRED_MSG) -def subwallet_type_not_same_as_base_wallet_raise_web_exception( - base_wallet_type: str, sub_wallet_type: str -) -> None: - """Raise a web exception when the subwallet type is not the same as the base wallet type.""" # noqa: E501 - if base_wallet_type != sub_wallet_type: - raise web.HTTPForbidden( - reason="Subwallet type must be the same as the base wallet type" - ) - - async def get_subwallet_profiles_from_storage(root_profile: Profile) -> list[Profile]: """Get subwallet profiles from storage.""" subwallet_profiles = []