From 1887b00435d2b27adb15feb0a0e8e02efe9a2bca Mon Sep 17 00:00:00 2001 From: Yevheniia Berdnyk Date: Tue, 12 Nov 2024 15:30:13 +0200 Subject: [PATCH] test_: added wallet tests (#6062) --- tests-functional/schemas/accounts_getAccounts | 104 ++++ .../schemas/appgeneral_getCurrencies | 60 +++ .../schemas/multiaccounts_getIdentityImages | 21 + .../wakuext_activityCenterNotifications | 33 ++ .../schemas/wallet_fetchMarketValues | 457 ++++++++++++++++++ tests-functional/schemas/wallet_fetchPrices | 169 +++++++ .../schemas/wallet_fetchTokenDetails | 313 ++++++++++++ .../schemas/wallet_filterActivityAsync | 53 ++ .../schemas/wallet_getOwnedCollectiblesAsync | 53 ++ .../wallet_getWalletConnectActiveSessions | 20 + .../schemas/wallet_getWalletToken | 216 +++++++++ ...wallet_stopSuggestedRoutesAsyncCalculation | 20 + tests-functional/tests/test_accounts.py | 5 +- tests-functional/tests/test_app_general.py | 23 + tests-functional/tests/test_cases.py | 12 +- tests-functional/tests/test_waku_rpc.py | 1 + tests-functional/tests/test_wallet_rpc.py | 34 +- tests-functional/tests/test_wallet_signals.py | 42 ++ 18 files changed, 1632 insertions(+), 4 deletions(-) create mode 100644 tests-functional/schemas/accounts_getAccounts create mode 100644 tests-functional/schemas/appgeneral_getCurrencies create mode 100644 tests-functional/schemas/multiaccounts_getIdentityImages create mode 100644 tests-functional/schemas/wakuext_activityCenterNotifications create mode 100644 tests-functional/schemas/wallet_fetchMarketValues create mode 100644 tests-functional/schemas/wallet_fetchPrices create mode 100644 tests-functional/schemas/wallet_fetchTokenDetails create mode 100644 tests-functional/schemas/wallet_filterActivityAsync create mode 100644 tests-functional/schemas/wallet_getOwnedCollectiblesAsync create mode 100644 tests-functional/schemas/wallet_getWalletConnectActiveSessions create mode 100644 tests-functional/schemas/wallet_getWalletToken create mode 100644 tests-functional/schemas/wallet_stopSuggestedRoutesAsyncCalculation create mode 100644 tests-functional/tests/test_app_general.py create mode 100644 tests-functional/tests/test_wallet_signals.py diff --git a/tests-functional/schemas/accounts_getAccounts b/tests-functional/schemas/accounts_getAccounts new file mode 100644 index 000000000..5bb01a1ea --- /dev/null +++ b/tests-functional/schemas/accounts_getAccounts @@ -0,0 +1,104 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "http://example.com/example.json", + "type": "object", + "required": [ + "id", + "jsonrpc", + "result" + ], + "properties": { + "id": { + "type": "string" + }, + "jsonrpc": { + "type": "string" + }, + "result": { + "type": "array", + "items": { + "type": "object", + "required": [ + "address", + "chat", + "clock", + "colorId", + "createdAt", + "emoji", + "hidden", + "key-uid", + "mixedcase-address", + "name", + "operable", + "path", + "position", + "prodPreferredChainIds", + "public-key", + "removed", + "testPreferredChainIds", + "type", + "wallet" + ], + "properties": { + "address": { + "type": "string" + }, + "chat": { + "type": "boolean" + }, + "clock": { + "type": "integer" + }, + "colorId": { + "type": "string" + }, + "createdAt": { + "type": "integer" + }, + "emoji": { + "type": "string" + }, + "hidden": { + "type": "boolean" + }, + "key-uid": { + "type": "string" + }, + "mixedcase-address": { + "type": "string" + }, + "name": { + "type": "string" + }, + "operable": { + "type": "string" + }, + "path": { + "type": "string" + }, + "position": { + "type": "integer" + }, + "prodPreferredChainIds": { + "type": "string" + }, + "public-key": { + "type": "string" + }, + "removed": { + "type": "boolean" + }, + "testPreferredChainIds": { + "type": "string" + }, + "type": { + "type": "string" + }, + "wallet": { + "type": "boolean" + } + } + } + } + } +} \ No newline at end of file diff --git a/tests-functional/schemas/appgeneral_getCurrencies b/tests-functional/schemas/appgeneral_getCurrencies new file mode 100644 index 000000000..82c39a0b3 --- /dev/null +++ b/tests-functional/schemas/appgeneral_getCurrencies @@ -0,0 +1,60 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "http://example.com/example.json", + "type": "object", + "required": [ + "id", + "jsonrpc", + "result" + ], + "properties": { + "id": { + "type": "string" + }, + "jsonrpc": { + "type": "string" + }, + "result": { + "type": "array", + "items": { + "type": "object", + "required": [ + "emoji", + "id", + "isPopular", + "isToken", + "name", + "shortName", + "symbol", + "unicode" + ], + "properties": { + "emoji": { + "type": "string" + }, + "id": { + "type": "string" + }, + "isPopular": { + "type": "boolean" + }, + "isToken": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "shortName": { + "type": "string" + }, + "symbol": { + "type": "string" + }, + "unicode": { + "type": "string" + } + } + } + } + } +} \ No newline at end of file diff --git a/tests-functional/schemas/multiaccounts_getIdentityImages b/tests-functional/schemas/multiaccounts_getIdentityImages new file mode 100644 index 000000000..374ebe0d0 --- /dev/null +++ b/tests-functional/schemas/multiaccounts_getIdentityImages @@ -0,0 +1,21 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "http://example.com/example.json", + "type": "object", + "required": [ + "id", + "jsonrpc", + "result" + ], + "properties": { + "id": { + "type": "string" + }, + "jsonrpc": { + "type": "string" + }, + "result": { + "type": "null" + } + } +} \ No newline at end of file diff --git a/tests-functional/schemas/wakuext_activityCenterNotifications b/tests-functional/schemas/wakuext_activityCenterNotifications new file mode 100644 index 000000000..455e7a93d --- /dev/null +++ b/tests-functional/schemas/wakuext_activityCenterNotifications @@ -0,0 +1,33 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "http://example.com/example.json", + "type": "object", + "required": [ + "id", + "jsonrpc", + "result" + ], + "properties": { + "id": { + "type": "string" + }, + "jsonrpc": { + "type": "string" + }, + "result": { + "type": "object", + "required": [ + "cursor", + "notifications" + ], + "properties": { + "cursor": { + "type": "string" + }, + "notifications": { + "type": "null" + } + } + } + } +} \ No newline at end of file diff --git a/tests-functional/schemas/wallet_fetchMarketValues b/tests-functional/schemas/wallet_fetchMarketValues new file mode 100644 index 000000000..b0646f009 --- /dev/null +++ b/tests-functional/schemas/wallet_fetchMarketValues @@ -0,0 +1,457 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "http://example.com/example.json", + "type": "object", + "required": [ + "jsonrpc", + "id", + "result" + ], + "properties": { + "jsonrpc": { + "type": "string" + }, + "id": { + "type": "string" + }, + "result": { + "type": "object", + "required": [ + "DAI", + "ETH", + "EUROC", + "STT", + "UNI", + "USDC", + "WEENUS", + "WETH", + "WETH9", + "XEENUS", + "YEENUS", + "ZEENUS" + ], + "properties": { + "DAI": { + "type": "object", + "required": [ + "MKTCAP", + "HIGHDAY", + "LOWDAY", + "CHANGEPCTHOUR", + "CHANGEPCTDAY", + "CHANGEPCT24HOUR", + "CHANGE24HOUR" + ], + "properties": { + "MKTCAP": { + "type": "number" + }, + "HIGHDAY": { + "type": "number" + }, + "LOWDAY": { + "type": "number" + }, + "CHANGEPCTHOUR": { + "type": "number" + }, + "CHANGEPCTDAY": { + "type": "number" + }, + "CHANGEPCT24HOUR": { + "type": "number" + }, + "CHANGE24HOUR": { + "type": "number" + } + } + }, + "ETH": { + "type": "object", + "required": [ + "MKTCAP", + "HIGHDAY", + "LOWDAY", + "CHANGEPCTHOUR", + "CHANGEPCTDAY", + "CHANGEPCT24HOUR", + "CHANGE24HOUR" + ], + "properties": { + "MKTCAP": { + "type": "number" + }, + "HIGHDAY": { + "type": "number" + }, + "LOWDAY": { + "type": "number" + }, + "CHANGEPCTHOUR": { + "type": "number" + }, + "CHANGEPCTDAY": { + "type": "number" + }, + "CHANGEPCT24HOUR": { + "type": "number" + }, + "CHANGE24HOUR": { + "type": "number" + } + } + }, + "EUROC": { + "type": "object", + "required": [ + "MKTCAP", + "HIGHDAY", + "LOWDAY", + "CHANGEPCTHOUR", + "CHANGEPCTDAY", + "CHANGEPCT24HOUR", + "CHANGE24HOUR" + ], + "properties": { + "MKTCAP": { + "type": "integer" + }, + "HIGHDAY": { + "type": "integer" + }, + "LOWDAY": { + "type": "integer" + }, + "CHANGEPCTHOUR": { + "type": "integer" + }, + "CHANGEPCTDAY": { + "type": "integer" + }, + "CHANGEPCT24HOUR": { + "type": "integer" + }, + "CHANGE24HOUR": { + "type": "integer" + } + } + }, + "STT": { + "type": "object", + "required": [ + "MKTCAP", + "HIGHDAY", + "LOWDAY", + "CHANGEPCTHOUR", + "CHANGEPCTDAY", + "CHANGEPCT24HOUR", + "CHANGE24HOUR" + ], + "properties": { + "MKTCAP": { + "type": "number" + }, + "HIGHDAY": { + "type": "number" + }, + "LOWDAY": { + "type": "number" + }, + "CHANGEPCTHOUR": { + "type": "number" + }, + "CHANGEPCTDAY": { + "type": "number" + }, + "CHANGEPCT24HOUR": { + "type": "number" + }, + "CHANGE24HOUR": { + "type": "number" + } + } + }, + "UNI": { + "type": "object", + "required": [ + "MKTCAP", + "HIGHDAY", + "LOWDAY", + "CHANGEPCTHOUR", + "CHANGEPCTDAY", + "CHANGEPCT24HOUR", + "CHANGE24HOUR" + ], + "properties": { + "MKTCAP": { + "type": "number" + }, + "HIGHDAY": { + "type": "number" + }, + "LOWDAY": { + "type": "number" + }, + "CHANGEPCTHOUR": { + "type": "number" + }, + "CHANGEPCTDAY": { + "type": "number" + }, + "CHANGEPCT24HOUR": { + "type": "number" + }, + "CHANGE24HOUR": { + "type": "number" + } + } + }, + "USDC": { + "type": "object", + "required": [ + "MKTCAP", + "HIGHDAY", + "LOWDAY", + "CHANGEPCTHOUR", + "CHANGEPCTDAY", + "CHANGEPCT24HOUR", + "CHANGE24HOUR" + ], + "properties": { + "MKTCAP": { + "type": "number" + }, + "HIGHDAY": { + "type": "number" + }, + "LOWDAY": { + "type": "number" + }, + "CHANGEPCTHOUR": { + "type": "number" + }, + "CHANGEPCTDAY": { + "type": "number" + }, + "CHANGEPCT24HOUR": { + "type": "number" + }, + "CHANGE24HOUR": { + "type": "number" + } + } + }, + "WEENUS": { + "type": "object", + "required": [ + "MKTCAP", + "HIGHDAY", + "LOWDAY", + "CHANGEPCTHOUR", + "CHANGEPCTDAY", + "CHANGEPCT24HOUR", + "CHANGE24HOUR" + ], + "properties": { + "MKTCAP": { + "type": "integer" + }, + "HIGHDAY": { + "type": "integer" + }, + "LOWDAY": { + "type": "integer" + }, + "CHANGEPCTHOUR": { + "type": "integer" + }, + "CHANGEPCTDAY": { + "type": "integer" + }, + "CHANGEPCT24HOUR": { + "type": "integer" + }, + "CHANGE24HOUR": { + "type": "integer" + } + } + }, + "WETH": { + "type": "object", + "required": [ + "MKTCAP", + "HIGHDAY", + "LOWDAY", + "CHANGEPCTHOUR", + "CHANGEPCTDAY", + "CHANGEPCT24HOUR", + "CHANGE24HOUR" + ], + "properties": { + "MKTCAP": { + "type": "number" + }, + "HIGHDAY": { + "type": "number" + }, + "LOWDAY": { + "type": "number" + }, + "CHANGEPCTHOUR": { + "type": "number" + }, + "CHANGEPCTDAY": { + "type": "number" + }, + "CHANGEPCT24HOUR": { + "type": "number" + }, + "CHANGE24HOUR": { + "type": "number" + } + } + }, + "WETH9": { + "type": "object", + "required": [ + "MKTCAP", + "HIGHDAY", + "LOWDAY", + "CHANGEPCTHOUR", + "CHANGEPCTDAY", + "CHANGEPCT24HOUR", + "CHANGE24HOUR" + ], + "properties": { + "MKTCAP": { + "type": "integer" + }, + "HIGHDAY": { + "type": "integer" + }, + "LOWDAY": { + "type": "integer" + }, + "CHANGEPCTHOUR": { + "type": "integer" + }, + "CHANGEPCTDAY": { + "type": "integer" + }, + "CHANGEPCT24HOUR": { + "type": "integer" + }, + "CHANGE24HOUR": { + "type": "integer" + } + } + }, + "XEENUS": { + "type": "object", + "required": [ + "MKTCAP", + "HIGHDAY", + "LOWDAY", + "CHANGEPCTHOUR", + "CHANGEPCTDAY", + "CHANGEPCT24HOUR", + "CHANGE24HOUR" + ], + "properties": { + "MKTCAP": { + "type": "integer" + }, + "HIGHDAY": { + "type": "integer" + }, + "LOWDAY": { + "type": "integer" + }, + "CHANGEPCTHOUR": { + "type": "integer" + }, + "CHANGEPCTDAY": { + "type": "integer" + }, + "CHANGEPCT24HOUR": { + "type": "integer" + }, + "CHANGE24HOUR": { + "type": "integer" + } + } + }, + "YEENUS": { + "type": "object", + "required": [ + "MKTCAP", + "HIGHDAY", + "LOWDAY", + "CHANGEPCTHOUR", + "CHANGEPCTDAY", + "CHANGEPCT24HOUR", + "CHANGE24HOUR" + ], + "properties": { + "MKTCAP": { + "type": "integer" + }, + "HIGHDAY": { + "type": "integer" + }, + "LOWDAY": { + "type": "integer" + }, + "CHANGEPCTHOUR": { + "type": "integer" + }, + "CHANGEPCTDAY": { + "type": "integer" + }, + "CHANGEPCT24HOUR": { + "type": "integer" + }, + "CHANGE24HOUR": { + "type": "integer" + } + } + }, + "ZEENUS": { + "type": "object", + "required": [ + "MKTCAP", + "HIGHDAY", + "LOWDAY", + "CHANGEPCTHOUR", + "CHANGEPCTDAY", + "CHANGEPCT24HOUR", + "CHANGE24HOUR" + ], + "properties": { + "MKTCAP": { + "type": "integer" + }, + "HIGHDAY": { + "type": "integer" + }, + "LOWDAY": { + "type": "integer" + }, + "CHANGEPCTHOUR": { + "type": "integer" + }, + "CHANGEPCTDAY": { + "type": "integer" + }, + "CHANGEPCT24HOUR": { + "type": "integer" + }, + "CHANGE24HOUR": { + "type": "integer" + } + } + } + } + } + } +} \ No newline at end of file diff --git a/tests-functional/schemas/wallet_fetchPrices b/tests-functional/schemas/wallet_fetchPrices new file mode 100644 index 000000000..a9630c102 --- /dev/null +++ b/tests-functional/schemas/wallet_fetchPrices @@ -0,0 +1,169 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "http://example.com/example.json", + "type": "object", + "required": [ + "id", + "jsonrpc", + "result" + ], + "properties": { + "id": { + "type": "string" + }, + "jsonrpc": { + "type": "string" + }, + "result": { + "type": "object", + "required": [ + "DAI", + "ETH", + "EUROC", + "STT", + "UNI", + "USDC", + "WEENUS", + "WETH", + "WETH9", + "XEENUS", + "YEENUS", + "ZEENUS" + ], + "properties": { + "DAI": { + "type": "object", + "required": [ + "usd" + ], + "properties": { + "usd": { + "type": "number" + } + } + }, + "ETH": { + "type": "object", + "required": [ + "usd" + ], + "properties": { + "usd": { + "type": "number" + } + } + }, + "EUROC": { + "type": "object", + "required": [ + "usd" + ], + "properties": { + "usd": { + "type": "integer" + } + } + }, + "STT": { + "type": "object", + "required": [ + "usd" + ], + "properties": { + "usd": { + "type": "number" + } + } + }, + "UNI": { + "type": "object", + "required": [ + "usd" + ], + "properties": { + "usd": { + "type": "number" + } + } + }, + "USDC": { + "type": "object", + "required": [ + "usd" + ], + "properties": { + "usd": { + "type": "number" + } + } + }, + "WEENUS": { + "type": "object", + "required": [ + "usd" + ], + "properties": { + "usd": { + "type": "integer" + } + } + }, + "WETH": { + "type": "object", + "required": [ + "usd" + ], + "properties": { + "usd": { + "type": "number" + } + } + }, + "WETH9": { + "type": "object", + "required": [ + "usd" + ], + "properties": { + "usd": { + "type": "integer" + } + } + }, + "XEENUS": { + "type": "object", + "required": [ + "usd" + ], + "properties": { + "usd": { + "type": "integer" + } + } + }, + "YEENUS": { + "type": "object", + "required": [ + "usd" + ], + "properties": { + "usd": { + "type": "integer" + } + } + }, + "ZEENUS": { + "type": "object", + "required": [ + "usd" + ], + "properties": { + "usd": { + "type": "integer" + } + } + } + } + } + } +} \ No newline at end of file diff --git a/tests-functional/schemas/wallet_fetchTokenDetails b/tests-functional/schemas/wallet_fetchTokenDetails new file mode 100644 index 000000000..aab6249a7 --- /dev/null +++ b/tests-functional/schemas/wallet_fetchTokenDetails @@ -0,0 +1,313 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "http://example.com/example.json", + "type": "object", + "required": [ + "jsonrpc", + "id", + "result" + ], + "properties": { + "jsonrpc": { + "type": "string" + }, + "id": { + "type": "string" + }, + "result": { + "type": "object", + "required": [ + "DAI", + "ETH", + "STT", + "UNI", + "USDC", + "WETH" + ], + "properties": { + "DAI": { + "type": "object", + "required": [ + "Id", + "Name", + "Symbol", + "Description", + "TotalCoinsMined", + "AssetLaunchDate", + "AssetWhitepaperUrl", + "AssetWebsiteUrl", + "BuiltOn", + "SmartContractAddress" + ], + "properties": { + "Id": { + "type": "string" + }, + "Name": { + "type": "string" + }, + "Symbol": { + "type": "string" + }, + "Description": { + "type": "string" + }, + "TotalCoinsMined": { + "type": "number" + }, + "AssetLaunchDate": { + "type": "string" + }, + "AssetWhitepaperUrl": { + "type": "string" + }, + "AssetWebsiteUrl": { + "type": "string" + }, + "BuiltOn": { + "type": "string" + }, + "SmartContractAddress": { + "type": "string" + } + } + }, + "ETH": { + "type": "object", + "required": [ + "Id", + "Name", + "Symbol", + "Description", + "TotalCoinsMined", + "AssetLaunchDate", + "AssetWhitepaperUrl", + "AssetWebsiteUrl", + "BuiltOn", + "SmartContractAddress" + ], + "properties": { + "Id": { + "type": "string" + }, + "Name": { + "type": "string" + }, + "Symbol": { + "type": "string" + }, + "Description": { + "type": "string" + }, + "TotalCoinsMined": { + "type": "number" + }, + "AssetLaunchDate": { + "type": "string" + }, + "AssetWhitepaperUrl": { + "type": "string" + }, + "AssetWebsiteUrl": { + "type": "string" + }, + "BuiltOn": { + "type": "string" + }, + "SmartContractAddress": { + "type": "string" + } + } + }, + "STT": { + "type": "object", + "required": [ + "Id", + "Name", + "Symbol", + "Description", + "TotalCoinsMined", + "AssetLaunchDate", + "AssetWhitepaperUrl", + "AssetWebsiteUrl", + "BuiltOn", + "SmartContractAddress" + ], + "properties": { + "Id": { + "type": "string" + }, + "Name": { + "type": "string" + }, + "Symbol": { + "type": "string" + }, + "Description": { + "type": "string" + }, + "TotalCoinsMined": { + "type": "number" + }, + "AssetLaunchDate": { + "type": "string" + }, + "AssetWhitepaperUrl": { + "type": "string" + }, + "AssetWebsiteUrl": { + "type": "string" + }, + "BuiltOn": { + "type": "string" + }, + "SmartContractAddress": { + "type": "string" + } + } + }, + "UNI": { + "type": "object", + "required": [ + "Id", + "Name", + "Symbol", + "Description", + "TotalCoinsMined", + "AssetLaunchDate", + "AssetWhitepaperUrl", + "AssetWebsiteUrl", + "BuiltOn", + "SmartContractAddress" + ], + "properties": { + "Id": { + "type": "string" + }, + "Name": { + "type": "string" + }, + "Symbol": { + "type": "string" + }, + "Description": { + "type": "string" + }, + "TotalCoinsMined": { + "type": "number" + }, + "AssetLaunchDate": { + "type": "string" + }, + "AssetWhitepaperUrl": { + "type": "string" + }, + "AssetWebsiteUrl": { + "type": "string" + }, + "BuiltOn": { + "type": "string" + }, + "SmartContractAddress": { + "type": "string" + } + } + }, + "USDC": { + "type": "object", + "required": [ + "Id", + "Name", + "Symbol", + "Description", + "TotalCoinsMined", + "AssetLaunchDate", + "AssetWhitepaperUrl", + "AssetWebsiteUrl", + "BuiltOn", + "SmartContractAddress" + ], + "properties": { + "Id": { + "type": "string" + }, + "Name": { + "type": "string" + }, + "Symbol": { + "type": "string" + }, + "Description": { + "type": "string" + }, + "TotalCoinsMined": { + "type": "number" + }, + "AssetLaunchDate": { + "type": "string" + }, + "AssetWhitepaperUrl": { + "type": "string" + }, + "AssetWebsiteUrl": { + "type": "string" + }, + "BuiltOn": { + "type": "string" + }, + "SmartContractAddress": { + "type": "string" + } + } + }, + "WETH": { + "type": "object", + "required": [ + "Id", + "Name", + "Symbol", + "Description", + "TotalCoinsMined", + "AssetLaunchDate", + "AssetWhitepaperUrl", + "AssetWebsiteUrl", + "BuiltOn", + "SmartContractAddress" + ], + "properties": { + "Id": { + "type": "string" + }, + "Name": { + "type": "string" + }, + "Symbol": { + "type": "string" + }, + "Description": { + "type": "string" + }, + "TotalCoinsMined": { + "type": "number" + }, + "AssetLaunchDate": { + "type": "string" + }, + "AssetWhitepaperUrl": { + "type": "string" + }, + "AssetWebsiteUrl": { + "type": "string" + }, + "BuiltOn": { + "type": "string" + }, + "SmartContractAddress": { + "type": "string" + } + } + } + } + } + } +} \ No newline at end of file diff --git a/tests-functional/schemas/wallet_filterActivityAsync b/tests-functional/schemas/wallet_filterActivityAsync new file mode 100644 index 000000000..77aaabcff --- /dev/null +++ b/tests-functional/schemas/wallet_filterActivityAsync @@ -0,0 +1,53 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "http://example.com/example.json", + "type": "object", + "required": [ + "type", + "event" + ], + "properties": { + "type": { + "type": "string" + }, + "event": { + "type": "object", + "required": [ + "type", + "blockNumber", + "accounts", + "message", + "at", + "chainId", + "requestId", + "EventParams" + ], + "properties": { + "type": { + "type": "string" + }, + "blockNumber": { + "type": "null" + }, + "accounts": { + "type": "null" + }, + "message": { + "type": "string" + }, + "at": { + "type": "integer" + }, + "chainId": { + "type": "integer" + }, + "requestId": { + "type": "integer" + }, + "EventParams": { + "type": "null" + } + } + } + } +} \ No newline at end of file diff --git a/tests-functional/schemas/wallet_getOwnedCollectiblesAsync b/tests-functional/schemas/wallet_getOwnedCollectiblesAsync new file mode 100644 index 000000000..77aaabcff --- /dev/null +++ b/tests-functional/schemas/wallet_getOwnedCollectiblesAsync @@ -0,0 +1,53 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "http://example.com/example.json", + "type": "object", + "required": [ + "type", + "event" + ], + "properties": { + "type": { + "type": "string" + }, + "event": { + "type": "object", + "required": [ + "type", + "blockNumber", + "accounts", + "message", + "at", + "chainId", + "requestId", + "EventParams" + ], + "properties": { + "type": { + "type": "string" + }, + "blockNumber": { + "type": "null" + }, + "accounts": { + "type": "null" + }, + "message": { + "type": "string" + }, + "at": { + "type": "integer" + }, + "chainId": { + "type": "integer" + }, + "requestId": { + "type": "integer" + }, + "EventParams": { + "type": "null" + } + } + } + } +} \ No newline at end of file diff --git a/tests-functional/schemas/wallet_getWalletConnectActiveSessions b/tests-functional/schemas/wallet_getWalletConnectActiveSessions new file mode 100644 index 000000000..813520451 --- /dev/null +++ b/tests-functional/schemas/wallet_getWalletConnectActiveSessions @@ -0,0 +1,20 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "properties": { + "id": { + "type": "string" + }, + "jsonrpc": { + "type": "string" + }, + "result": { + "type": "null" + } + }, + "required": [ + "id", + "jsonrpc", + "result" + ], + "type": "object" +} \ No newline at end of file diff --git a/tests-functional/schemas/wallet_getWalletToken b/tests-functional/schemas/wallet_getWalletToken new file mode 100644 index 000000000..cffba50c3 --- /dev/null +++ b/tests-functional/schemas/wallet_getWalletToken @@ -0,0 +1,216 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "http://example.com/example.json", + "type": "object", + "required": [ + "id", + "jsonrpc", + "result" + ], + "properties": { + "id": { + "type": "string" + }, + "jsonrpc": { + "type": "string" + }, + "result": { + "type": "object", + "required": [ + "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266" + ], + "properties": { + "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266": { + "type": "array", + "items": { + "type": "object", + "required": [ + "address", + "assetWebsiteUrl", + "balancesPerChain", + "builtOn", + "chainId", + "decimals", + "description", + "marketValuesPerCurrency", + "name", + "pegSymbol", + "symbol", + "tokenListId", + "verified" + ], + "properties": { + "address": { + "type": "string" + }, + "assetWebsiteUrl": { + "type": "string" + }, + "balancesPerChain": { + "type": "object", + "required": [ + "31337" + ], + "properties": { + "31337": { + "type": "object", + "required": [ + "address", + "balance", + "balance1DayAgo", + "chainId", + "hasError", + "rawBalance" + ], + "properties": { + "address": { + "type": "string" + }, + "balance": { + "type": "string" + }, + "balance1DayAgo": { + "type": "string" + }, + "chainId": { + "type": "integer" + }, + "hasError": { + "type": "boolean" + }, + "rawBalance": { + "type": "string" + } + } + } + } + }, + "builtOn": { + "type": "string" + }, + "chainId": { + "type": "integer" + }, + "decimals": { + "type": "integer" + }, + "description": { + "type": "string" + }, + "marketValuesPerCurrency": { + "type": "object", + "required": [ + "USD", + "usd" + ], + "properties": { + "USD": { + "type": "object", + "required": [ + "change24hour", + "changePct24hour", + "changePctDay", + "changePctHour", + "hasError", + "highDay", + "lowDay", + "marketCap", + "price" + ], + "properties": { + "change24hour": { + "type": "number" + }, + "changePct24hour": { + "type": "number" + }, + "changePctDay": { + "type": "number" + }, + "changePctHour": { + "type": "number" + }, + "hasError": { + "type": "boolean" + }, + "highDay": { + "type": "number" + }, + "lowDay": { + "type": "number" + }, + "marketCap": { + "type": "number" + }, + "price": { + "type": "number" + } + } + }, + "usd": { + "type": "object", + "required": [ + "change24hour", + "changePct24hour", + "changePctDay", + "changePctHour", + "hasError", + "highDay", + "lowDay", + "marketCap", + "price" + ], + "properties": { + "change24hour": { + "type": "number" + }, + "changePct24hour": { + "type": "number" + }, + "changePctDay": { + "type": "number" + }, + "changePctHour": { + "type": "number" + }, + "hasError": { + "type": "boolean" + }, + "highDay": { + "type": "number" + }, + "lowDay": { + "type": "number" + }, + "marketCap": { + "type": "number" + }, + "price": { + "type": "number" + } + } + } + } + }, + "name": { + "type": "string" + }, + "pegSymbol": { + "type": "string" + }, + "symbol": { + "type": "string" + }, + "tokenListId": { + "type": "string" + }, + "verified": { + "type": "boolean" + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/tests-functional/schemas/wallet_stopSuggestedRoutesAsyncCalculation b/tests-functional/schemas/wallet_stopSuggestedRoutesAsyncCalculation new file mode 100644 index 000000000..813520451 --- /dev/null +++ b/tests-functional/schemas/wallet_stopSuggestedRoutesAsyncCalculation @@ -0,0 +1,20 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "properties": { + "id": { + "type": "string" + }, + "jsonrpc": { + "type": "string" + }, + "result": { + "type": "null" + } + }, + "required": [ + "id", + "jsonrpc", + "result" + ], + "type": "object" +} \ No newline at end of file diff --git a/tests-functional/tests/test_accounts.py b/tests-functional/tests/test_accounts.py index 0b3c35030..c38b534d9 100644 --- a/tests-functional/tests/test_accounts.py +++ b/tests-functional/tests/test_accounts.py @@ -2,6 +2,7 @@ import random import pytest +from constants import user_1 from test_cases import StatusBackendTestCase @@ -12,9 +13,11 @@ class TestAccounts(StatusBackendTestCase): @pytest.mark.parametrize( "method, params", [ + ("accounts_getAccounts", []), ("accounts_getKeypairs", []), ("accounts_hasPairedDevices", []), - ("accounts_remainingAccountCapacity", []) + ("accounts_remainingAccountCapacity", []), + ("multiaccounts_getIdentityImages", [user_1.private_key]), ], ) diff --git a/tests-functional/tests/test_app_general.py b/tests-functional/tests/test_app_general.py new file mode 100644 index 000000000..907483f60 --- /dev/null +++ b/tests-functional/tests/test_app_general.py @@ -0,0 +1,23 @@ +import random + +import pytest + +from test_cases import StatusBackendTestCase + + +@pytest.mark.accounts +@pytest.mark.rpc +class TestAppGeneral(StatusBackendTestCase): + + @pytest.mark.parametrize( + "method, params", + [ + ("appgeneral_getCurrencies", []), + + ], + ) + def test_(self, method, params): + _id = str(random.randint(1, 8888)) + + response = self.rpc_client.rpc_valid_request(method, params, _id) + self.rpc_client.verify_json_schema(response.json(), method) diff --git a/tests-functional/tests/test_cases.py b/tests-functional/tests/test_cases.py index ef77c85e0..b9a4e3c9b 100644 --- a/tests-functional/tests/test_cases.py +++ b/tests-functional/tests/test_cases.py @@ -22,8 +22,10 @@ class StatusDTestCase: class StatusBackendTestCase: + await_signals = [] + def setup_class(self): - self.rpc_client = StatusBackend() + self.rpc_client = StatusBackend(await_signals=self.await_signals) self.network_id = 31337 @@ -140,3 +142,11 @@ class SignalTestCase(StatusDTestCase): websocket_thread = threading.Thread(target=self.signal_client._connect) websocket_thread.daemon = True websocket_thread.start() + + +class SignalBackendTestCase(StatusBackendTestCase): + + def setup_method(self): + websocket_thread = threading.Thread(target=self.rpc_client._connect) + websocket_thread.daemon = True + websocket_thread.start() diff --git a/tests-functional/tests/test_waku_rpc.py b/tests-functional/tests/test_waku_rpc.py index cde29a041..332937993 100644 --- a/tests-functional/tests/test_waku_rpc.py +++ b/tests-functional/tests/test_waku_rpc.py @@ -15,6 +15,7 @@ class TestRpc(StatusBackendTestCase): "method, params", [ ("wakuext_peers", []), + ("wakuext_activityCenterNotifications", [{"cursor": "", "limit": 20, "activityTypes": [5], "readType": 2}]) ], ) def test_(self, method, params): diff --git a/tests-functional/tests/test_wallet_rpc.py b/tests-functional/tests/test_wallet_rpc.py index 968e599b9..475dca706 100644 --- a/tests-functional/tests/test_wallet_rpc.py +++ b/tests-functional/tests/test_wallet_rpc.py @@ -5,7 +5,8 @@ import jsonschema import pytest from conftest import option -from test_cases import StatusBackendTestCase, TransactionTestCase +from constants import user_1 +from test_cases import StatusBackendTestCase, TransactionTestCase, StatusDTestCase @pytest.mark.wallet @@ -85,7 +86,36 @@ class TestRpc(StatusBackendTestCase): ("wallet_getEthereumChains", []), ("wallet_getTokenList", []), ("wallet_getCryptoOnRamps", []), - ("wallet_getCachedCurrencyFormats", []) + ("wallet_getCachedCurrencyFormats", []), + ("wallet_fetchPrices", + [["WETH9", "USDC", "ZEENUS", "EUROC", "WEENUS", "XEENUS", "WETH", "ETH", "STT", "UNI", "YEENUS", "DAI"], + ["usd"]]), + + ("wallet_fetchMarketValues", + [["WETH9", "USDC", "ZEENUS", "EUROC", "WEENUS", "XEENUS", "WETH", "ETH", "STT", "UNI", "YEENUS", "DAI"], + "usd"]), + ("wallet_fetchTokenDetails", + [["WETH9", "USDC", "ZEENUS", "EUROC", "WEENUS", "XEENUS", "WETH", "ETH", "STT", "UNI", "YEENUS", "DAI"]]), + ("wallet_checkRecentHistoryForChainIDs", [[31337], [user_1.address]]), + ("wallet_getWalletConnectActiveSessions", [1728995277]), + ("wallet_stopSuggestedRoutesAsyncCalculation", []), + ] + ) + def test_(self, method, params): + _id = str(random.randint(1, 8888)) + + response = self.rpc_client.rpc_valid_request(method, params, _id) + self.rpc_client.verify_json_schema(response.json(), method) + + +@pytest.mark.wallet +@pytest.mark.rpc +class TestRpcStatusD(StatusDTestCase): # temp for methods not implemented in Status Backend + + @pytest.mark.parametrize( + "method, params", + [ + ("wallet_getWalletToken", [[user_1.address, ]]), ], ) def test_(self, method, params): diff --git a/tests-functional/tests/test_wallet_signals.py b/tests-functional/tests/test_wallet_signals.py new file mode 100644 index 000000000..4118440bc --- /dev/null +++ b/tests-functional/tests/test_wallet_signals.py @@ -0,0 +1,42 @@ +import json +import random + +import pytest + +from constants import user_1 +from test_cases import SignalBackendTestCase + + +@pytest.mark.wallet +@pytest.mark.rpc +class TestWalletRpcSignal(SignalBackendTestCase): + await_signals = ["wallet", ] + + def setup_method(self): + super().setup_method() + self.request_id = str(random.randint(1, 8888)) + + def test_wallet_get_owned_collectibles_async(self): + method = "wallet_getOwnedCollectiblesAsync" + params = [0, [self.network_id, ], [user_1.address], None, 0, 25, 1, + {"fetch-type": 2, "max-cache-age-seconds": 3600}] + self.rpc_client.rpc_valid_request(method, params, self.request_id) + signal_response = self.rpc_client.wait_for_signal("wallet", timeout=60) + self.rpc_client.verify_json_schema(signal_response, method) + assert signal_response['event']['type'] == "wallet-owned-collectibles-filtering-done" + message = json.loads(signal_response['event']['message'].replace("'", "\"")) + assert user_1.address in message['ownershipStatus'].keys() + + def test_wallet_filter_activity_async(self): + method = "wallet_filterActivityAsync" + params = [1, [user_1.address], [self.network_id], + {"period": {"startTimestamp": 0, "endTimestamp": 0}, "types": [], "statuses": [], + "counterpartyAddresses": [], "assets": [], "collectibles": [], "filterOutAssets": False, + "filterOutCollectibles": False}, 0, 50] + self.rpc_client.rpc_valid_request(method, params, self.request_id) + signal_response = self.rpc_client.wait_for_signal("wallet", timeout=60) + self.rpc_client.verify_json_schema(signal_response, method) + assert signal_response['event']['type'] == "wallet-activity-filtering-done" + message = json.loads(signal_response['event']['message'].replace("'", "\"")) + for item in message['activities']: + assert user_1.address in item['sender'], item['recipient']