test_: added a couple of new schemas and methods (#5843)

This commit is contained in:
Anastasiya 2024-09-18 10:55:47 +03:00 committed by GitHub
parent 596d75ab79
commit d036f208bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 7515 additions and 9 deletions

View File

@ -0,0 +1,150 @@
{
"$schema": "http://json-schema.org/schema#",
"properties": {
"id": {
"type": "string"
},
"jsonrpc": {
"type": "string"
},
"result": {
"items": {
"properties": {
"accounts": {
"items": {
"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"
}
},
"required": [
"address",
"chat",
"clock",
"colorId",
"createdAt",
"emoji",
"hidden",
"key-uid",
"mixedcase-address",
"name",
"operable",
"path",
"position",
"prodPreferredChainIds",
"public-key",
"removed",
"testPreferredChainIds",
"type",
"wallet"
],
"type": "object"
},
"type": "array"
},
"clock": {
"type": "integer"
},
"derived-from": {
"type": "string"
},
"key-uid": {
"type": "string"
},
"keycards": {
"type": "array"
},
"last-used-derivation-index": {
"type": "integer"
},
"name": {
"type": "string"
},
"removed": {
"type": "boolean"
},
"synced-from": {
"type": "string"
},
"type": {
"type": "string"
}
},
"required": [
"accounts",
"clock",
"derived-from",
"key-uid",
"keycards",
"last-used-derivation-index",
"name",
"removed",
"synced-from",
"type"
],
"type": "object"
},
"type": "array"
}
},
"required": [
"id",
"jsonrpc",
"result"
],
"type": "object"
}

View File

@ -0,0 +1,20 @@
{
"$schema": "http://json-schema.org/schema#",
"properties": {
"id": {
"type": "string"
},
"jsonrpc": {
"type": "string"
},
"result": {
"type": "boolean"
}
},
"required": [
"id",
"jsonrpc",
"result"
],
"type": "object"
}

View File

@ -0,0 +1,20 @@
{
"$schema": "http://json-schema.org/schema#",
"properties": {
"id": {
"type": "string"
},
"jsonrpc": {
"type": "string"
},
"result": {
"type": "integer"
}
},
"required": [
"id",
"jsonrpc",
"result"
],
"type": "object"
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,28 @@
import random
import pytest
import jsonschema
import json
from conftest import option
from test_cases import RpcTestCase
@pytest.mark.accounts
@pytest.mark.rpc
class TestAccounts(RpcTestCase):
@pytest.mark.parametrize(
"method, params",
[
("accounts_getKeypairs", []),
("accounts_hasPairedDevices", []),
("accounts_remainingAccountCapacity", [])
],
)
def test_(self, method, params):
_id = str(random.randint(1, 8888))
response = self.rpc_request(method, params, _id)
self.verify_is_valid_json_rpc_response(response)
with open(f"{option.base_dir}/schemas/{method}", "r") as schema:
jsonschema.validate(instance=response.json(), schema=json.load(schema))

View File

@ -25,7 +25,6 @@ class TestTransactionRpc(TransactionTestCase):
],
)
def test_tx_(self, method, params):
_id = str(random.randint(1, 9999))
if method in ["wallet_getPendingTransactionsForIdentities"]:
@ -57,9 +56,10 @@ class TestRpc(RpcTestCase):
[
("wallet_startWallet", []),
("wallet_getEthereumChains", []),
("wallet_startWallet", []),
("wallet_getTokenList", []),
("wallet_getCryptoOnRamps", []),
("wallet_getCachedCurrencyFormats", []),
("wallet_fetchAllCurrencyFormats", [])
],
)
def test_(self, method, params):