Skip to content

Commit

Permalink
add simple API test using pyresttest tool steemit#1567
Browse files Browse the repository at this point in the history
  • Loading branch information
mkochanowicz committed Oct 17, 2017
1 parent facf4c5 commit dbbed70
Show file tree
Hide file tree
Showing 13 changed files with 636 additions and 0 deletions.
9 changes: 9 additions & 0 deletions python_scripts/tests/api_tests/basic_smoketest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- config:
- testset: "Basic steemd API Smoke Test"

- test:
- name: "Test ip address"
- group: "basic_smoketest"
- url: "/rpc"
- method: "POST"
- body: '{}'
143 changes: 143 additions & 0 deletions python_scripts/tests/api_tests/database_api/database_api_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
---
- config:
- testset: "Database API Tests"
- variable_binds:
- api: "database_api"
- generators:
- test_id: {type: 'number_sequence', start: 1}

- test:
- generator_binds:
- test_id: test_id
- group: "database_api"
- name: "get_dynamical_global_properties"
- url: "/rpc"
- method: "POST"
- variable_binds:
- method: "get_dynamic_global_properties"
- args: {}
- body: {template: {file: "request_template.json"}}
- validators:
- extract_test: {jsonpath_mini: "error", test: "not_exists"}
- extract_test: {jsonpath_mini: "result", test: "exists"}
- compare: {jsonpath_mini: "id", comparator: "str_eq", expected: {template: $test_id}}
- json_file_compare: {jsonpath_mini: "result", comparator: "eq", expected: {template: '$api/$method'}}

- test:
- generator_binds:
- test_id: test_id
- group: "database_api"
- name: "get_config"
- url: "/rpc"
- method: "POST"
- variable_binds:
- method: "get_config"
- args: {}
- body: {template: {file: "request_template.json"}}
- validators:
- extract_test: {jsonpath_mini: "error", test: "not_exists"}
- extract_test: {jsonpath_mini: "result", test: "exists"}
- compare: {jsonpath_mini: "id", comparator: "str_eq", expected: {template: $test_id}}
- json_file_compare: {jsonpath_mini: "result", comparator: "eq", expected: {template: '$api/$method'}}

- test:
- generator_binds:
- test_id: test_id
- group: "database_api"
- name: "get_witness_schedule"
- url: "/rpc"
- method: "POST"
- variable_binds:
- method: "get_witness_schedule"
- args: {}
- body: {template: {file: "request_template.json"}}
- validators:
- extract_test: {jsonpath_mini: "error", test: "not_exists"}
- extract_test: {jsonpath_mini: "result", test: "exists"}
- compare: {jsonpath_mini: "id", comparator: "str_eq", expected: {template: $test_id}}
- json_file_compare: {jsonpath_mini: "result", comparator: "eq", expected: {template: '$api/$method'}}

- test:
- generator_binds:
- test_id: test_id
- group: "database_api"
- name: "get_hardfork_properties"
- url: "/rpc"
- method: "POST"
- variable_binds:
- method: "get_hardfork_properties"
- args: {}
- body: {template: {file: "request_template.json"}}
- validators:
- extract_test: {jsonpath_mini: "error", test: "not_exists"}
- extract_test: {jsonpath_mini: "result", test: "exists"}
- compare: {jsonpath_mini: "id", comparator: "str_eq", expected: {template: $test_id}}
- json_file_compare: {jsonpath_mini: "result", comparator: "eq", expected: {template: '$api/$method'}}

- test:
- generator_binds:
- test_id: test_id
- group: "database_api"
- name: "get_reward_funds"
- url: "/rpc"
- method: "POST"
- variable_binds:
- method: "get_reward_funds"
- args: {}
- body: {template: {file: "request_template.json"}}
- validators:
- extract_test: {jsonpath_mini: "error", test: "not_exists"}
- extract_test: {jsonpath_mini: "result", test: "exists"}
- compare: {jsonpath_mini: "id", comparator: "str_eq", expected: {template: $test_id}}
- json_file_compare: {jsonpath_mini: "result", comparator: "eq", expected: {template: '$api/$method'}}

- test:
- generator_binds:
- test_id: test_id
- group: "database_api"
- name: "get_current_price_feed"
- url: "/rpc"
- method: "POST"
- variable_binds:
- method: "get_current_price_feed"
- args: {}
- body: {template: {file: "request_template.json"}}
- validators:
- extract_test: {jsonpath_mini: "error", test: "not_exists"}
- extract_test: {jsonpath_mini: "result", test: "exists"}
- compare: {jsonpath_mini: "id", comparator: "str_eq", expected: {template: $test_id}}
- json_file_compare: {jsonpath_mini: "result", comparator: "eq", expected: {template: '$api/$method'}}

- test:
- generator_binds:
- test_id: test_id
- group: "database_api"
- name: "get_feed_history"
- url: "/rpc"
- method: "POST"
- variable_binds:
- method: "get_feed_history"
- args: {}
- body: {template: {file: "request_template.json"}}
- validators:
- extract_test: {jsonpath_mini: "error", test: "not_exists"}
- extract_test: {jsonpath_mini: "result", test: "exists"}
- compare: {jsonpath_mini: "id", comparator: "str_eq", expected: {template: $test_id}}
- json_file_compare: {jsonpath_mini: "result", comparator: "eq", expected: {template: '$api/$method'}}

- test:
- generator_binds:
- test_id: test_id
- group: "database_api"
- name: "list_witnesses"
- url: "/rpc"
- method: "POST"
- variable_binds:
- method: "list_witnesses"
- args: '{ "start": 0, "limit": 1, "order": "by_name" }'
- body: {template: {file: "request_template.json"}}
- validators:
- extract_test: {jsonpath_mini: "error", test: "not_exists"}
- extract_test: {jsonpath_mini: "result", test: "exists"}
- compare: {jsonpath_mini: "id", comparator: "str_eq", expected: {template: $test_id}}
- json_file_compare: {jsonpath_mini: "result", comparator: "eq", expected: {template: '$api/$method'}}
158 changes: 158 additions & 0 deletions python_scripts/tests/api_tests/database_api/get_config.json.pat
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
{
"IS_TEST_NET": true,
"SBD_SYMBOL": "TBD",
"SMT_UPVOTE_LOCKOUT": 43200,
"SMT_VESTING_WITHDRAW_INTERVAL_SECONDS": 604800,
"STEEM_100_PERCENT": 10000,
"STEEM_1_PERCENT": 100,
"STEEM_ACCOUNT_RECOVERY_REQUEST_EXPIRATION_PERIOD": 12000000,
"STEEM_ACTIVE_CHALLENGE_COOLDOWN": "86400000000",
"STEEM_ACTIVE_CHALLENGE_FEE": "2.000 TESTS",
"STEEM_ADDRESS_PREFIX": "TST",
"STEEM_APR_PERCENT_MULTIPLY_PER_BLOCK": "102035135585887",
"STEEM_APR_PERCENT_MULTIPLY_PER_HOUR": "119577151364285",
"STEEM_APR_PERCENT_MULTIPLY_PER_ROUND": "133921203762304",
"STEEM_APR_PERCENT_SHIFT_PER_BLOCK": 87,
"STEEM_APR_PERCENT_SHIFT_PER_HOUR": 77,
"STEEM_APR_PERCENT_SHIFT_PER_ROUND": 83,
"STEEM_BANDWIDTH_AVERAGE_WINDOW_SECONDS": 604800,
"STEEM_BANDWIDTH_PRECISION": 1000000,
"STEEM_BLOCKCHAIN_HARDFORK_VERSION": "0.21.0",
"STEEM_BLOCKCHAIN_PRECISION": 1000,
"STEEM_BLOCKCHAIN_PRECISION_DIGITS": 3,
"STEEM_BLOCKCHAIN_VERSION": "0.21.0",
"STEEM_BLOCKS_PER_DAY": 28800,
"STEEM_BLOCKS_PER_HOUR": 1200,
"STEEM_BLOCKS_PER_YEAR": 10512000,
"STEEM_BLOCK_INTERVAL": 3,
"STEEM_CASHOUT_WINDOW_SECONDS": 3600,
"STEEM_CASHOUT_WINDOW_SECONDS_PRE_HF12": 3600,
"STEEM_CASHOUT_WINDOW_SECONDS_PRE_HF17": 3600,
"STEEM_CHAIN_ID": "18dcf0a285365fc58b71f18b3d3fec954aa0c141c44e4e5cb4cf777b9eab274e",
"STEEM_COMMENT_REWARD_FUND_NAME": "comment",
"STEEM_CONTENT_APR_PERCENT": 3875,
"STEEM_CONTENT_CONSTANT_HF0": "2000000000000",
"STEEM_CONTENT_REWARD_PERCENT": 7500,
"STEEM_CONVERSION_DELAY": "302400000000",
"STEEM_CONVERSION_DELAY_PRE_HF_16": "604800000000",
"STEEM_CREATE_ACCOUNT_DELEGATION_RATIO": 5,
"STEEM_CREATE_ACCOUNT_DELEGATION_TIME": "2592000000000",
"STEEM_CREATE_ACCOUNT_WITH_STEEM_MODIFIER": 30,
"STEEM_CURATE_APR_PERCENT": 3875,
"STEEM_DEFAULT_SBD_INTEREST_RATE": 1000,
"STEEM_ENABLE_SMT": true,
"STEEM_EQUIHASH_K": 6,
"STEEM_EQUIHASH_N": 140,
"STEEM_FEED_HISTORY_WINDOW": 84,
"STEEM_FEED_HISTORY_WINDOW_PRE_HF_16": 168,
"STEEM_FEED_INTERVAL_BLOCKS": 1200,
"STEEM_GENESIS_TIME": "2016-01-01T00:00:00",
"STEEM_HARDFORK_REQUIRED_WITNESSES": 17,
"STEEM_INFLATION_NARROWING_PERIOD": 250000,
"STEEM_INFLATION_RATE_START_PERCENT": 978,
"STEEM_INFLATION_RATE_STOP_PERCENT": 95,
"STEEM_INITIAL_VOTE_POWER_RATE": 40,
"STEEM_INIT_MINER_NAME": "initminer",
"STEEM_INIT_PUBLIC_KEY_STR": "TST6LLegbAgLAy28EHrffBVuANFWcFgmqRMW13wBmTExqFE9SCkg4",
"STEEM_INIT_SUPPLY": 0,
"STEEM_INIT_TIME": "1970-01-01T00:00:00",
"STEEM_IRREVERSIBLE_THRESHOLD": 7500,
"STEEM_LIQUIDITY_APR_PERCENT": 750,
"STEEM_LIQUIDITY_REWARD_BLOCKS": 1200,
"STEEM_LIQUIDITY_REWARD_PERIOD_SEC": 3600,
"STEEM_LIQUIDITY_TIMEOUT_SEC": "604800000000",
"STEEM_MAX_ACCOUNT_NAME_LENGTH": 16,
"STEEM_MAX_ACCOUNT_WITNESS_VOTES": 30,
"STEEM_MAX_ASSET_WHITELIST_AUTHORITIES": 10,
"STEEM_MAX_AUTHORITY_MEMBERSHIP": 10,
"STEEM_MAX_BLOCK_SIZE": 393216000,
"STEEM_MAX_CASHOUT_WINDOW_SECONDS": 86400,
"STEEM_MAX_COMMENT_DEPTH": 65535,
"STEEM_MAX_COMMENT_DEPTH_PRE_HF17": 6,
"STEEM_MAX_FEED_AGE_SECONDS": 604800,
"STEEM_MAX_INSTANCE_ID": "281474976710655",
"STEEM_MAX_MEMO_SIZE": 2048,
"STEEM_MAX_MINER_WITNESSES_HF0": 1,
"STEEM_MAX_MINER_WITNESSES_HF17": 0,
"STEEM_MAX_PERMLINK_LENGTH": 256,
"STEEM_MAX_PROXY_RECURSION_DEPTH": 4,
"STEEM_MAX_RATION_DECAY_RATE": 1000000,
"STEEM_MAX_RESERVE_RATIO": 20000,
"STEEM_MAX_RUNNER_WITNESSES_HF0": 1,
"STEEM_MAX_RUNNER_WITNESSES_HF17": 1,
"STEEM_MAX_SHARE_SUPPLY": "1000000000000000",
"STEEM_MAX_SIG_CHECK_DEPTH": 2,
"STEEM_MAX_TIME_UNTIL_EXPIRATION": 3600,
"STEEM_MAX_TRANSACTION_SIZE": 65536,
"STEEM_MAX_UNDO_HISTORY": 10000,
"STEEM_MAX_URL_LENGTH": 127,
"STEEM_MAX_VOTED_WITNESSES_HF0": 19,
"STEEM_MAX_VOTED_WITNESSES_HF17": 20,
"STEEM_MAX_VOTE_CHANGES": 5,
"STEEM_MAX_WITHDRAW_ROUTES": 10,
"STEEM_MAX_WITNESSES": 21,
"STEEM_MAX_WITNESS_URL_LENGTH": 2048,
"STEEM_MINER_ACCOUNT": "miners",
"STEEM_MINER_PAY_PERCENT": 100,
"STEEM_MINING_REWARD": "1.000 TESTS",
"STEEM_MINING_TIME": "2016-01-01T00:00:00",
"STEEM_MIN_ACCOUNT_CREATION_FEE": 0,
"STEEM_MIN_ACCOUNT_NAME_LENGTH": 3,
"STEEM_MIN_BLOCK_SIZE_LIMIT": 65536,
"STEEM_MIN_CONTENT_REWARD": "1.000 TESTS",
"STEEM_MIN_CURATE_REWARD": "1.000 TESTS",
"STEEM_MIN_FEEDS": 7,
"STEEM_MIN_LIQUIDITY_REWARD": "1200.000 TESTS",
"STEEM_MIN_LIQUIDITY_REWARD_PERIOD_SEC": 60000000,
"STEEM_MIN_PAYOUT_SBD": "0.020 TBD",
"STEEM_MIN_PERMLINK_LENGTH": 0,
"STEEM_MIN_POW_REWARD": "1.000 TESTS",
"STEEM_MIN_PRODUCER_REWARD": "1.000 TESTS",
"STEEM_MIN_REPLY_INTERVAL": 20000000,
"STEEM_MIN_ROOT_COMMENT_INTERVAL": 300000000,
"STEEM_MIN_TRANSACTION_EXPIRATION_LIMIT": 15,
"STEEM_MIN_TRANSACTION_SIZE_LIMIT": 1024,
"STEEM_MIN_UNDO_HISTORY": 10,
"STEEM_MIN_VOTE_INTERVAL_SEC": 3,
"STEEM_NULL_ACCOUNT": "null",
"STEEM_NUM_INIT_MINERS": 1,
"STEEM_OWNER_AUTH_HISTORY_TRACKING_START_BLOCK_NUM": 1,
"STEEM_OWNER_AUTH_RECOVERY_PERIOD": 60000000,
"STEEM_OWNER_CHALLENGE_COOLDOWN": "86400000000",
"STEEM_OWNER_CHALLENGE_FEE": "30.000 TESTS",
"STEEM_OWNER_UPDATE_LIMIT": 0,
"STEEM_POST_AVERAGE_WINDOW": 86400,
"STEEM_POST_REWARD_FUND_NAME": "post",
"STEEM_POST_WEIGHT_CONSTANT": 1600000000,
"STEEM_POW_APR_PERCENT": 750,
"STEEM_PRODUCER_APR_PERCENT": 750,
"STEEM_PROXY_TO_SELF_ACCOUNT": "",
"STEEM_RECENT_RSHARES_DECAY_TIME_HF17": "2592000000000",
"STEEM_RECENT_RSHARES_DECAY_TIME_HF19": "1296000000000",
"STEEM_REDUCED_VOTE_POWER_RATE": 10,
"STEEM_REVERSE_AUCTION_WINDOW_SECONDS": 1800,
"STEEM_ROOT_POST_PARENT": "",
"STEEM_SAVINGS_WITHDRAW_REQUEST_LIMIT": 100,
"STEEM_SAVINGS_WITHDRAW_TIME": "259200000000",
"STEEM_SBD_INTEREST_COMPOUND_INTERVAL_SEC": 2592000,
"STEEM_SBD_START_PERCENT": 200,
"STEEM_SBD_STOP_PERCENT": 500,
"STEEM_SECONDS_PER_YEAR": 31536000,
"STEEM_SECOND_CASHOUT_WINDOW": 259200,
"STEEM_SOFT_MAX_COMMENT_DEPTH": 255,
"STEEM_START_MINER_VOTING_BLOCK": 864000,
"STEEM_START_VESTING_BLOCK": 201600,
"STEEM_SYMBOL": "TESTS",
"STEEM_TEMP_ACCOUNT": "temp",
"STEEM_UPVOTE_LOCKOUT_HF17": 300000000,
"STEEM_UPVOTE_LOCKOUT_HF7": 60000000,
"STEEM_VESTING_FUND_PERCENT": 1500,
"STEEM_VESTING_WITHDRAW_INTERVALS": 13,
"STEEM_VESTING_WITHDRAW_INTERVALS_PRE_HF_16": 104,
"STEEM_VESTING_WITHDRAW_INTERVAL_SECONDS": 604800,
"STEEM_VIRTUAL_SCHEDULE_LAP_LENGTH": "18446744073709551615",
"STEEM_VIRTUAL_SCHEDULE_LAP_LENGTH2": "340282366920938463463374607431768211455",
"STEEM_VOTE_DUST_THRESHOLD": 50000000,
"STEEM_VOTE_REGENERATION_SECONDS": 432000,
"VESTS_SYMBOL": "VESTS"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"base": "0.000 TESTS",
"quote": "0.000 TESTS"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"confidential_sbd_supply": "0.000 TBD",
"confidential_supply": "0.000 TESTS",
"current_aslot": 0,
"current_sbd_supply": "0.000 TBD",
"current_supply": "0.000 TESTS",
"current_witness": "initminer",
"head_block_id": "0000000000000000000000000000000000000000",
"head_block_number": 0,
"id": 0,
"last_irreversible_block_num": 0,
"maximum_block_size": 393216000,
"num_pow_witnesses": 0,
"participation_count": 128,
"pending_rewarded_vesting_shares": "0.000000 VESTS",
"pending_rewarded_vesting_steem": "0.000 TESTS",
"recent_slots_filled": "340282366920938463463374607431768211455",
"sbd_interest_rate": 0,
"sbd_print_rate": 10000,
"smt_creation_fee": "1000.000 TBD",
"time": "2016-01-01T00:00:00",
"total_pow": "18446744073709551615",
"total_reward_fund_steem": "0.000 TESTS",
"total_reward_shares2": "0",
"total_vesting_fund_steem": "0.000 TESTS",
"total_vesting_shares": "0.000000 VESTS",
"virtual_supply": "0.000 TESTS",
"vote_power_reserve_rate": 40
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"current_median_history": {
"base": "0.000 TESTS",
"quote": "0.000 TESTS"
},
"id": 0,
"price_history": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"current_hardfork_version": "0.0.0",
"id": 0,
"last_hardfork": 0,
"next_hardfork": "0.0.0",
"next_hardfork_time": "1970-01-01T00:00:00",
"processed_hardforks": [
"2016-01-01T00:00:00"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"funds": []
}
Loading

0 comments on commit dbbed70

Please sign in to comment.