From 3479406bece6895a74aa05af1bb1bd849d22499f Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Fri, 9 Apr 2021 17:12:36 +0300 Subject: Change tester to help with routes tests --- tester.sh | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 50 insertions(+), 13 deletions(-) (limited to 'tester.sh') diff --git a/tester.sh b/tester.sh index a0396d6..e6bb007 100755 --- a/tester.sh +++ b/tester.sh @@ -2,37 +2,74 @@ ## When in doubt just write a shell script +## new transaction curl --request POST \ --header 'Content-Type: application/json' \ --data '{ - "source": "foo", - "target": "bar", - "amount": 5, - "timestamp": "2021-04-07T00:17:00" + "source": "old_transaction_hash_1", + "target": "target_account", + "amount": 20, + "timestamp": "2021-04-09T01:30:30" }' \ http://localhost:8080/transaction +## new transaction curl --request POST \ --header 'Content-Type: application/json' \ --data '{ - "source": "saz", - "target": "quux", - "amount": 12, - "timestamp": "2021-04-07T00:17:00" + "source": "old_transaction_hash_2", + "target": "target_account", + "amount": 20, + "timestamp": "2021-04-09T01:31:30" }' \ http://localhost:8080/transaction +## new transaction +curl --request POST \ + --header 'Content-Type: application/json' \ + --data '{ + "source": "old_transaction_hash_3", + "target": "target_account", + "amount": 20, + "timestamp": "2021-04-09T01:32:30" +}' \ + http://localhost:8080/transaction + +printf "\n\nList of current transactions\n\n" +## list transactions curl localhost:8080/transaction curl --header "Content-Type: application/json" \ --request POST \ --data '{ "transaction_list": [ - "foo", - "saz" + "old_transaction_hash_1", + "old_transaction_hash_2", + "old_transaction_hash_3" ], - "nonce": 4, - "timestamp": "2021-04-07T04:17:00", - "hash": "aaaaaa" + "nonce": "not_a_thing_yet", + "timestamp": "2021-04-08T12:30:30", + "hash": "not_a_thing_yet" }' \ http://localhost:8080/block + +printf "\n\nShould be scooped up by the block\n\n" +## list transactions +curl localhost:8080/transaction + +curl --request POST \ + --header 'Content-Type: application/json' \ + --data '{ + "source": "source_account", + "target": "target_account", + "amount": 20, + "timestamp": "2021-04-09T01:30:30" +}' \ + http://localhost:8080/transaction + +printf "\n\nShould have only one transaction\n\n" +curl localhost:8080/transaction + +printf "\n\nShould have only one block\n\n" +curl localhost:8080/block + -- cgit v1.2.3-70-g09d2