File tree Expand file tree Collapse file tree 1 file changed +11
-18
lines changed Expand file tree Collapse file tree 1 file changed +11
-18
lines changed Original file line number Diff line number Diff line change @@ -24,26 +24,19 @@ load '../../libs/version'
24
24
load ' utils/_helpers'
25
25
26
26
@test " transactions: Outdated transactions cannot be committed" {
27
- # creating 5 transactions
28
- for _ in {1..5}; do
29
- resource_post " $_TRANSACTIONS_BASE_PATH " " "
30
- assert_equal " $SC " 201
31
- done
27
+ resource_post " $_TRANSACTIONS_BASE_PATH " " "
28
+ assert_equal " $SC " 201
29
+ local first_id; first_id=$( get_json_path " ${BODY} " " .id" )
32
30
33
- # retrieving the first one
34
- resource_get " $_TRANSACTIONS_BASE_PATH "
35
- local id ; id =$( get_json_path " ${BODY} " " .[0] .id" )
31
+ resource_post " $_TRANSACTIONS_BASE_PATH " " "
32
+ assert_equal " $SC " 201
33
+ local second_id ; second_id =$( get_json_path " ${BODY} " " .id" )
36
34
37
- # commit it , must succeed
38
- resource_put " $_TRANSACTIONS_BASE_PATH /$id " " "
35
+ # commit first one , must succeed
36
+ resource_put " $_TRANSACTIONS_BASE_PATH /$first_id " " "
39
37
assert_equal " $SC " 202
40
38
41
- # retrieve other transactions
42
- resource_get " $_TRANSACTIONS_BASE_PATH "
43
- assert_equal " $SC " 200
44
- # iterate over them, should fail with 406 status code
45
- for tx in $( echo " ${BODY} " | jq -r ' .[].id' ) ; do
46
- resource_put " $_TRANSACTIONS_BASE_PATH /${tx} " " "
47
- assert_equal " $SC " 406
48
- done
39
+ # try to commit second one, must be outdated
40
+ resource_put " $_TRANSACTIONS_BASE_PATH /$second_id " " "
41
+ assert_equal " $SC " 406
49
42
}
You can’t perform that action at this time.
0 commit comments