diff options
author | Yigit Sever | 2021-04-09 17:12:36 +0300 |
---|---|---|
committer | Yigit Sever | 2021-04-09 17:12:36 +0300 |
commit | 3479406bece6895a74aa05af1bb1bd849d22499f (patch) | |
tree | 4e14c5f62a39e171eae1e729d6e5da4882b0414f /tester.sh | |
parent | dc19e3767b8262d4f5cc7c3e9a501fae3c5e9f8c (diff) | |
download | gradecoin-3479406bece6895a74aa05af1bb1bd849d22499f.tar.gz gradecoin-3479406bece6895a74aa05af1bb1bd849d22499f.tar.bz2 gradecoin-3479406bece6895a74aa05af1bb1bd849d22499f.zip |
Change tester to help with routes tests
Diffstat (limited to 'tester.sh')
-rwxr-xr-x | tester.sh | 63 |
1 files changed, 50 insertions, 13 deletions
@@ -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 | ||
5 | curl --request POST \ | 6 | curl --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 | ||
15 | curl --request POST \ | 17 | curl --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 | ||
28 | curl --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 | |||
38 | printf "\n\nList of current transactions\n\n" | ||
39 | ## list transactions | ||
25 | curl localhost:8080/transaction | 40 | curl localhost:8080/transaction |
26 | 41 | ||
27 | curl --header "Content-Type: application/json" \ | 42 | curl --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 | |||
56 | printf "\n\nShould be scooped up by the block\n\n" | ||
57 | ## list transactions | ||
58 | curl localhost:8080/transaction | ||
59 | |||
60 | curl --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 | |||
70 | printf "\n\nShould have only one transaction\n\n" | ||
71 | curl localhost:8080/transaction | ||
72 | |||
73 | printf "\n\nShould have only one block\n\n" | ||
74 | curl localhost:8080/block | ||
75 | |||