diff --git a/tests/conftest.py b/tests/conftest.py
index 532754145..5a2999059 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -1,4 +1,6 @@
import asyncio
+import copy
+import inspect
from datetime import datetime, timezone
from uuid import uuid4
@@ -23,7 +25,12 @@ from lnbits.core.services import create_user_account, update_wallet_balance
from lnbits.core.services.payments import create_wallet_invoice
from lnbits.core.views.auth_api import first_install
from lnbits.db import DB_TYPE, SQLITE, Database
-from lnbits.settings import AuthMethods, FiatProviderLimits, Settings
+from lnbits.settings import (
+ AuthMethods,
+ EditableSettings,
+ FiatProviderLimits,
+ Settings,
+)
from lnbits.settings import settings as lnbits_settings
from lnbits.wallets.fake import FakeWallet
from tests.helpers import (
@@ -33,6 +40,21 @@ from tests.helpers import (
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
ADMIN_USER_ID = uuid4().hex
+_PURE_SETTINGS = Settings()
+_PURE_SETTINGS_FIELDS = tuple(
+ sorted(
+ {
+ field_name
+ for field_name in Settings.readonly_fields()
+ if field_name != "super_user"
+ }
+ | {
+ name
+ for name in inspect.signature(EditableSettings).parameters
+ if not name.startswith("_")
+ }
+ )
+)
@pytest.fixture(scope="session")
@@ -328,7 +350,21 @@ async def new_user(username: str | None = None) -> User:
return user
+def _restore_pure_settings(settings: Settings):
+ for field_name in _PURE_SETTINGS_FIELDS:
+ setattr(
+ settings, field_name, copy.deepcopy(getattr(_PURE_SETTINGS, field_name))
+ )
+
+
def _settings_cleanup(settings: Settings):
+ _restore_pure_settings(settings)
+ settings.auth_https_only = False
+ settings.lnbits_data_folder = "./tests/data"
+ settings.bundle_assets = True
+ settings.lnbits_admin_ui = True
+ settings.lnbits_extensions_default_install = []
+ settings.lnbits_extensions_deactivate_all = True
settings.lnbits_allow_new_accounts = True
settings.lnbits_allowed_users = []
settings.auth_allowed_methods = AuthMethods.all()
diff --git a/tests/wallets/index.html b/tests/wallets/index.html
new file mode 100644
index 000000000..bb22ca0b9
--- /dev/null
+++ b/tests/wallets/index.html
@@ -0,0 +1,6396 @@
+
+
+
+
+
+ Wallet Fixture Studio
+
+
+
+
+
+
+
+
+
+
Wallet Fixture Studio
+
Test matrix for wallet funding sources
+
{{ currentLoadedFileName }}
+
+
+
+
+
+
+
+
+
+
+
+
+
Funding Sources
+
+
+ {{ currentDataset.analysis.summary.fundingSources }}
+
+
+
+
+
+
Functions
+
+ {{ currentDataset.analysis.summary.functions }}
+
+
+
+
Raw Test Cases
+
+ {{ currentDataset.analysis.summary.rawTests }}
+
+
+
+
Expanded Wallet Tests
+
+ {{ currentDataset.analysis.summary.expandedTests }}
+
+
+
+
+
+ {{ currentDataset.loadError }}
+
+
+
+
+
+
+
+
+
+
{{ fn.name }}
+
{{ fn.tests.length }} tests
+
+
+
+
+
+
+
+
+
+ {{ group.label }}
+
+
+
+
+
+
+
+
+
+
+ {{ testEntry.note }}
+
+
+
+
+
+
+
+ {{ testEntry.callParamsError }}
+
+
+
+
+
+
+ {{ testEntry.expectedError }}
+
+
+
+
+
+
+
+
+
+ expand_more
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ expand_more
+
+
+
+
+
+
+
+
+ {{ item.requestBodyError }}
+
+
+
+
+
+
+
+
+
+ expand_more
+
+
+
+
+
+
+
+
+ {{ item.responseError }}
+
+
+
+
+
+
+
+
+
+
+
+
+ Test label for this RPC mock
+ variant.
+
+
+
+
+
+
+
+
+
+
+
+ Mocked RPC method name used by the
+ wallet code.
+
+
+
+
+
+
+
+ Optional label for the nested RPC
+ call.
+
+
+
+
+
+
+
+
+
+ expand_more
+
+
+
+ How the mocked RPC callable is
+ invoked.
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Optional request class used by
+ the RPC test harness.
+
+
+
+
+
+
+
+ JSON array of positional
+ arguments passed into the RPC
+ call.
+
+
+ {{ item.requestArgsError }}
+
+
+
+
+
+
+
+ JSON object of keyword
+ arguments passed into the RPC
+ call.
+
+
+ {{ item.requestKwargsError }}
+
+
+
+
+
+
+
+
+
+ expand_more
+
+
+
+ Return mode expected by the test
+ harness.
+
+
+
+
+
+ Business data returned by this
+ mocked RPC call.
+
+
+ {{ item.responseError }}
+
+
+
+
+
+
+
+ {{ item.error }}
+
+
+
+
+
+ No objects are defined in this mock array
+ yet.
+
+
+
+
+
+
+
+
+ {{ mockSet.error }}
+
+
+
+
+
+ No wallet-specific mock entry is defined for
+ {{ currentTestFundingSource.name }}
+ in this test.
+
+
+
+
+
+
+
+
+ No tests are defined for this function.
+
+
+
+
+
+ No functions are defined for this fixture file.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ expand_more
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ row.error }}
+
+
+
+
+
+
+ No settings are defined yet for this funding source.
+
+
+
+
+
+
+
+
+ No funding sources are defined for this fixture file.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Mock Name: Stable mock identifier used inside this
+ function's fixture map.
+
+
+
+
+
+
+
+
+
+
+ expand_more
+
+
+
+ Request Type: Choose REST for HTTP
+ mocks or RPC for Python patch mocks.
+
+
+
+
+
+
+ {{ functionMockMethodHint(mockRow) }}
+
+
+
+
+
+
+ Path: Request path or URI matcher for REST mocks.
+
+
+
+
+
+
+
+
+ Headers JSON: JSON object of request headers that
+ must match.
+
+
+
+
+
+
+ Query Params JSON: JSON object of expected
+ query-string parameters.
+
+
+
+
+
+
+
+
+
+ expand_more
+
+
+
+ Response Type: Optional RPC return mode such as
+ data, function,
+ async-function, json,
+ or exception.
+
+
+
+
+
+
+ Response: RPC mock object returned by the
+ patched function.
+
+
+
+
+
+
+
+ {{ mockRow.error }}
+
+
+ Leave unused fields blank. JSON columns must contain
+ valid JSON objects or values.
+
+
+
+
+
+
+
+ No function-level mocks are defined yet for
+ {{ currentTestFundingSource.name }}
+ in
+ {{ currentFunction.name }}.
+
+
+
+
+
+
+
+
+ Select a funding source and function first.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Raw JSON Editor
+
+ Edit the current fixture file directly, then apply, save, or
+ download the changes.
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ currentDataset.parseError }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+