Skip to content
Snippets Groups Projects
Commit 9210ff40 authored by Michal Zander's avatar Michal Zander
Browse files

Add patterns for REST api

parent 4a343a8d
No related branches found
No related tags found
1 merge request!171Unify API returns to sql composite types, add pattern tests for REST API
Pipeline #118952 passed
Showing
with 327 additions and 0 deletions
---
name: Common test values
description: Common values for tests
variables:
service:
proto: http
server: "{tavern.env_vars.BTRACKER_ADDRESS}"
port: "{tavern.env_vars.BTRACKER_PORT}"
{
"hbd_balance": 77246982,
"hive_balance": 29594875,
"vesting_shares": "8172549681941451",
"vesting_balance_hive": 2720696229,
"post_voting_power_vests": "8172549681941451",
"delegated_vests": "0",
"received_vests": "0",
"curation_rewards": "196115157",
"posting_rewards": "65916519",
"hbd_rewards": 0,
"hive_rewards": 0,
"vests_rewards": "0",
"hive_vesting_rewards": 0,
"hbd_savings": 0,
"hive_savings": 0,
"savings_withdraw_requests": 0,
"vesting_withdraw_rate": "80404818220529",
"to_withdraw": "8362101094935031",
"withdrawn": "804048182205290",
"withdraw_routes": 4,
"delayed_vests": "0"
}
\ No newline at end of file
---
test_name: btracker PostgREST
marks:
- patterntest
includes:
- !include ../common.yaml
stages:
- name: test
request:
url: "{service.proto:s}://{service.server:s}:{service.port}/rpc/get_account_balances"
method: POST
headers:
content-type: application/json
accept: application/json
json:
account-name: "blocktrades"
response:
status_code: 200
verify_response_with:
function: validate_response:compare_rest_response_with_pattern
\ No newline at end of file
{
"hbd_balance": 3465,
"hive_balance": 0,
"vesting_shares": "17579100476774",
"vesting_balance_hive": 5852200,
"post_voting_power_vests": "17579100476774",
"delegated_vests": "0",
"received_vests": "0",
"curation_rewards": "19888",
"posting_rewards": "1972916",
"hbd_rewards": 0,
"hive_rewards": 0,
"vests_rewards": "0",
"hive_vesting_rewards": 0,
"hbd_savings": 0,
"hive_savings": 0,
"savings_withdraw_requests": 0,
"vesting_withdraw_rate": "0",
"to_withdraw": "0",
"withdrawn": "0",
"withdraw_routes": 0,
"delayed_vests": "0"
}
\ No newline at end of file
---
test_name: btracker PostgREST
marks:
- patterntest
includes:
- !include ../common.yaml
stages:
- name: test
request:
url: "{service.proto:s}://{service.server:s}:{service.port}/rpc/get_account_balances"
method: POST
headers:
content-type: application/json
accept: application/json
json:
account-name: "gtg"
response:
status_code: 200
verify_response_with:
function: validate_response:compare_rest_response_with_pattern
\ No newline at end of file
{
"code": "P0001",
"details": null,
"hint": null,
"message": "Account 'themarkymark' does not exist"
}
\ No newline at end of file
---
test_name: btracker PostgREST
marks:
- patterntest
- negative
includes:
- !include ../common.yaml
stages:
- name: test
request:
url: "{service.proto:s}://{service.server:s}:{service.port}/rpc/get_account_balances"
method: POST
headers:
content-type: application/json
accept: application/json
json:
account-name: "themarkymark"
response:
status_code: 400
verify_response_with:
function: validate_response:compare_rest_response_with_pattern
extra_kwargs:
error_response: true
\ No newline at end of file
{
"outgoing_delegations": [],
"incoming_delegations": []
}
\ No newline at end of file
---
test_name: btracker PostgREST
marks:
- patterntest
includes:
- !include ../common.yaml
stages:
- name: test
request:
url: "{service.proto:s}://{service.server:s}:{service.port}/rpc/get_balance_delegations"
method: POST
headers:
content-type: application/json
accept: application/json
json:
account-name: "blocktrades"
response:
status_code: 200
verify_response_with:
function: validate_response:compare_rest_response_with_pattern
\ No newline at end of file
{
"outgoing_delegations": [],
"incoming_delegations": []
}
\ No newline at end of file
---
test_name: btracker PostgREST
marks:
- patterntest
includes:
- !include ../common.yaml
stages:
- name: test
request:
url: "{service.proto:s}://{service.server:s}:{service.port}/rpc/get_balance_delegations"
method: POST
headers:
content-type: application/json
accept: application/json
json:
account-name: "gtg"
response:
status_code: 200
verify_response_with:
function: validate_response:compare_rest_response_with_pattern
\ No newline at end of file
{
"code": "P0001",
"details": null,
"hint": null,
"message": "Account 'themarkymark' does not exist"
}
\ No newline at end of file
---
test_name: btracker PostgREST
marks:
- patterntest
- negative
includes:
- !include ../common.yaml
stages:
- name: test
request:
url: "{service.proto:s}://{service.server:s}:{service.port}/rpc/get_balance_delegations"
method: POST
headers:
content-type: application/json
accept: application/json
json:
account-name: "themarkymark"
response:
status_code: 400
verify_response_with:
function: validate_response:compare_rest_response_with_pattern
extra_kwargs:
error_response: true
\ No newline at end of file
{
"code": "P0001",
"details": null,
"hint": null,
"message": "page-size <= 1000: page-size of 1001 is greater than maxmimum allowed"
}
\ No newline at end of file
---
test_name: btracker PostgREST
marks:
- patterntest
- negative
includes:
- !include ../../common.yaml
stages:
- name: test
request:
url: "{service.proto:s}://{service.server:s}:{service.port}/rpc/get_balance_history"
method: POST
headers:
content-type: application/json
accept: application/json
json:
account-name: "blocktrades"
coin-type: "HBD"
page-size: 1001
response:
status_code: 400
verify_response_with:
function: validate_response:compare_rest_response_with_pattern
extra_kwargs:
error_response: true
{
"code": "P0001",
"details": null,
"hint": null,
"message": "Invalid format: d400000"
}
\ No newline at end of file
---
test_name: btracker PostgREST
marks:
- patterntest
- negative
includes:
- !include ../../common.yaml
stages:
- name: test
request:
url: "{service.proto:s}://{service.server:s}:{service.port}/rpc/get_balance_history"
method: POST
headers:
content-type: application/json
accept: application/json
json:
account-name: "blocktrades"
coin-type: "HBD"
from-block: "d400000"
response:
status_code: 400
verify_response_with:
function: validate_response:compare_rest_response_with_pattern
extra_kwargs:
error_response: true
{
"code": "P0001",
"details": null,
"hint": null,
"message": "Invalid format: 201608-12T19:38:51"
}
\ No newline at end of file
---
test_name: btracker PostgREST
marks:
- patterntest
- negative
includes:
- !include ../../common.yaml
stages:
- name: test
request:
url: "{service.proto:s}://{service.server:s}:{service.port}/rpc/get_balance_history"
method: POST
headers:
content-type: application/json
accept: application/json
json:
account-name: "blocktrades"
coin-type: "HBD"
from-block: "201608-12T19:38:51"
response:
status_code: 400
verify_response_with:
function: validate_response:compare_rest_response_with_pattern
extra_kwargs:
error_response: true
{
"code": "P0001",
"details": null,
"hint": null,
"message": "page <= 0: page of -1 is lesser or equal 0"
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment