forked from iotaledger-archive/iri
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1_api_tests.feature
More file actions
248 lines (182 loc) · 7.79 KB
/
1_api_tests.feature
File metadata and controls
248 lines (182 loc) · 7.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
Feature: Test API calls on Machine 1
Test various api calls to make sure they are responding
correctly.
Scenario: GetNodeInfo is called
#All api calls will be formatted as following, any arguments should be
#listed below the call in table format
#Example:
# "<Api Call name here>" is called on "<insert node name here>" with:
#|keys |values |type |
#|<arg key> |<arg val> |<arg type> |
#
#See tests/features/steps/api_test_steps.py for further details
#
Given "getNodeInfo" is called on "nodeA" with:
|keys |values |type |
Then a response with the following is returned:
|keys |
|appName |
|appVersion |
|duration |
|features |
|jreAvailableProcessors |
|jreFreeMemory |
|jreMaxMemory |
|jreTotalMemory |
|jreVersion |
|latestMilestone |
|latestMilestoneIndex |
|latestSolidSubtangleMilestone |
|latestSolidSubtangleMilestoneIndex |
|milestoneStartIndex |
|neighbors |
|packetsQueueSize |
|time |
|tips |
|transactionsToRequest |
|coordinatorAddress |
Scenario: GetNeighbors is called
Given "addNeighbors" is called on "nodeA" with:
|keys |values |type |
|uris |nodeB |nodeAddress |
And "getNeighbors" is called on "nodeA" with:
|keys |values |type |
Then a response with the following is returned:
|keys |
|address |
|numberOfAllTransactions |
|numberOfRandomTransactionRequests |
|numberOfNewTransactions |
|numberOfInvalidTransactions |
|numberOfSentTransactions |
|connectionType |
Scenario: Add and Remove Neighbors
Adds nodeB as a neighbor to nodeA, and then removes it.
Given "addNeighbors" is called on "nodeA" with:
|keys |values |type |
|uris |nodeB |nodeAddress |
Then a response with the following is returned:
|keys |
|addedNeighbors |
|duration |
When "removeNeighbors" is called on "nodeA" with:
|keys |values |type |
|uris |nodeB |nodeAddress |
Then a response with the following is returned:
|keys |
|duration |
|removedNeighbors |
Scenario: GetTips is called
Given "getTips" is called on "nodeA" with:
|keys |values |type |
Then a response with the following is returned:
|keys |
|hashes |
|duration |
#Values can be found in util/static_vals.py
Scenario: GetTrytes is called
Given "getTrytes" is called on "nodeA" with:
|keys |values |type |
|hashes |TEST_HASH |staticList |
Then the response for "getTrytes" should return with:
|keys |values |type |
|trytes |TEST_TRYTES |staticValue |
Scenario: GetTransactionsToApprove is called
Given "getTransactionsToApprove" is called on "nodeA" with:
|keys |values |type |
|depth |3 |int |
Then a response with the following is returned:
|keys |
|branchTransaction |
|duration |
|trunkTransaction |
Scenario: CheckConsistency is called
Given "checkConsistency" is called on "nodeA" with:
|keys |values |type |
|tails |TEST_HASH |staticList |
Then the response for "checkConsistency" should return with:
|keys |values |type |
|state |True |bool |
When an inconsistent transaction is generated on "nodeA"
And "checkConsistency" is called on "nodeA" with:
|keys |values |type |
|tails |inconsistentTransactions |responseList |
Then the response for "checkConsistency" should return with:
|keys |values |type |
|state |False |bool |
#Values can be found in util/static_vals.py
Scenario: GetInclusionStates is called
Given "getInclusionStates" is called on "nodeA" with:
|keys |values |type |
|transactions |TEST_HASH |staticList |
|tips |TEST_TIP_LIST |staticValue |
Then the response for "getInclusionStates" should return with:
|keys |values |type |
|states |False |bool |
#Address can be found in util/static_vals.py
Scenario: GetBalances is called
Given "getBalances" is called on "nodeA" with:
|keys |values |type |
|addresses |TEST_EMPTY_ADDRESS |staticList |
|threshold |100 |int |
Then the response for "getBalances" should return with:
|keys |values |type |
|balances |0 |int |
Scenario: Interrupt attach to tangle
Begins attaching a transaction to the tangle with a high MWM, then issues an interrupt to the node
If the interrupt is successful, the attachToTangle response will return a null tryte list
Given "attachToTangle" is called in parallel on "nodeA" with:
|keys |values |type |
|trytes |EMPTY_TRANSACTION_TRYTES|staticList |
|trunk_transaction |TEST_HASH |staticValue |
|branch_transaction |TEST_HASH |staticValue |
|min_weight_magnitude |50 |int |
And we wait "1" second/seconds
Then "interruptAttachingToTangle" is called in parallel on "nodeA" with:
|keys |values |type |
# Do not include duration in the return expectations as it will always return a variable amount
Then the "attachToTangle" parallel call should return with:
|keys |values |type |
|trytes |NULL_LIST |staticValue |
Scenario: WereAddressesSpentFrom is called
Given "wereAddressesSpentFrom" is called on "nodeA" with:
|keys |values |type |
|addresses |TEST_EMPTY_ADDRESS |staticList |
Then a response with the following is returned:
|keys |
|duration |
|states |
Scenario: Create, attach, store and find a transaction
Generate a transaction, attach it to the tangle, and store it locally. Then find
that transaction via its address.
Given a transaction is generated and attached on "nodeA" with:
|keys |values |type |
|address |TEST_STORE_ADDRESS |staticValue |
|value |0 |int |
Then a response with the following is returned:
|keys |
|trytes |
When "storeTransactions" is called on "nodeA" with:
|keys |values |type |
|trytes |TEST_STORE_TRANSACTION |staticValue |
And "findTransactions" is called on "nodeA" with:
|keys |values |type |
|addresses |TEST_STORE_ADDRESS |staticList |
Then a response with the following is returned:
|keys |
|hashes |
Scenario: Broadcast a test transacion
Send a test transaction from one node in a machine with a unique tag, and find that transaction
through a different node in the same machine
Given "nodeA" and "nodeB" are neighbors
When a transaction is generated and attached on "nodeA" with:
|keys |values |type |
|address |TEST_ADDRESS |staticValue |
|tag |TEST9TAG9ONE |string |
|value |0 |int |
#Give the transaction time to propagate
And we wait "3" second/seconds
And "findTransactions" is called on "nodeB" with:
|keys |values |type |
|tags |TEST9TAG9ONE |list |
Then a response for "findTransactions" should exist