aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYigit Sever2021-04-09 17:12:36 +0300
committerYigit Sever2021-04-09 17:12:36 +0300
commit3479406bece6895a74aa05af1bb1bd849d22499f (patch)
tree4e14c5f62a39e171eae1e729d6e5da4882b0414f
parentdc19e3767b8262d4f5cc7c3e9a501fae3c5e9f8c (diff)
downloadgradecoin-3479406bece6895a74aa05af1bb1bd849d22499f.tar.gz
gradecoin-3479406bece6895a74aa05af1bb1bd849d22499f.tar.bz2
gradecoin-3479406bece6895a74aa05af1bb1bd849d22499f.zip
Change tester to help with routes tests
-rwxr-xr-xtester.sh63
1 files changed, 50 insertions, 13 deletions
diff --git a/tester.sh b/tester.sh
index a0396d6..e6bb007 100755
--- a/tester.sh
+++ b/tester.sh
@@ -2,37 +2,74 @@
2 2
3## When in doubt just write a shell script 3## When in doubt just write a shell script
4 4
5## new transaction
5curl --request POST \ 6curl --request POST \
6 --header 'Content-Type: application/json' \ 7 --header 'Content-Type: application/json' \
7 --data '{ 8 --data '{
8 "source": "foo", 9 "source": "old_transaction_hash_1",
9 "target": "bar", 10 "target": "target_account",
10 "amount": 5, 11 "amount": 20,
11 "timestamp": "2021-04-07T00:17:00" 12 "timestamp": "2021-04-09T01:30:30"
12}' \ 13}' \
13 http://localhost:8080/transaction 14 http://localhost:8080/transaction
14 15
16## new transaction
15curl --request POST \ 17curl --request POST \
16 --header 'Content-Type: application/json' \ 18 --header 'Content-Type: application/json' \
17 --data '{ 19 --data '{
18 "source": "saz", 20 "source": "old_transaction_hash_2",
19 "target": "quux", 21 "target": "target_account",
20 "amount": 12, 22 "amount": 20,
21 "timestamp": "2021-04-07T00:17:00" 23 "timestamp": "2021-04-09T01:31:30"
22}' \ 24}' \
23 http://localhost:8080/transaction 25 http://localhost:8080/transaction
24 26
27## new transaction
28curl --request POST \
29 --header 'Content-Type: application/json' \
30 --data '{
31 "source": "old_transaction_hash_3",
32 "target": "target_account",
33 "amount": 20,
34 "timestamp": "2021-04-09T01:32:30"
35}' \
36 http://localhost:8080/transaction
37
38printf "\n\nList of current transactions\n\n"
39## list transactions
25curl localhost:8080/transaction 40curl localhost:8080/transaction
26 41
27curl --header "Content-Type: application/json" \ 42curl --header "Content-Type: application/json" \
28 --request POST \ 43 --request POST \
29 --data '{ 44 --data '{
30 "transaction_list": [ 45 "transaction_list": [
31 "foo", 46 "old_transaction_hash_1",
32 "saz" 47 "old_transaction_hash_2",
48 "old_transaction_hash_3"
33 ], 49 ],
34 "nonce": 4, 50 "nonce": "not_a_thing_yet",
35 "timestamp": "2021-04-07T04:17:00", 51 "timestamp": "2021-04-08T12:30:30",
36 "hash": "aaaaaa" 52 "hash": "not_a_thing_yet"
37}' \ 53}' \
38 http://localhost:8080/block 54 http://localhost:8080/block
55
56printf "\n\nShould be scooped up by the block\n\n"
57## list transactions
58curl localhost:8080/transaction
59
60curl --request POST \
61 --header 'Content-Type: application/json' \
62 --data '{
63 "source": "source_account",
64 "target": "target_account",
65 "amount": 20,
66 "timestamp": "2021-04-09T01:30:30"
67}' \
68 http://localhost:8080/transaction
69
70printf "\n\nShould have only one transaction\n\n"
71curl localhost:8080/transaction
72
73printf "\n\nShould have only one block\n\n"
74curl localhost:8080/block
75