@@ -39,36 +39,13 @@ def test_pass_happy_path(self):
39
39
request = {
40
40
# Raw trytes are extracted to match the IRI's JSON protocol.
41
41
'transactions' : [self .trytes1 , self .trytes2 ],
42
-
43
- # These values would normally be different from
44
- # ``transactions``, but for purposes of this unit test, we just
45
- # need to make sure the format is correct.
46
- 'tips' : [self .trytes1 , self .trytes2 ],
47
42
}
48
43
49
44
filter_ = self ._filter (request )
50
45
51
46
self .assertFilterPasses (filter_ )
52
47
self .assertDictEqual (filter_ .cleaned_data , request )
53
48
54
- def test_pass_optional_parameters_omitted (self ):
55
- """
56
- The request omits optional parameters.
57
- """
58
- filter_ = self ._filter ({
59
- 'transactions' : [self .trytes1 , self .trytes2 ],
60
- })
61
-
62
- self .assertFilterPasses (filter_ )
63
- self .assertDictEqual (
64
- filter_ .cleaned_data ,
65
-
66
- {
67
- 'tips' : [],
68
- 'transactions' : [self .trytes1 , self .trytes2 ],
69
- },
70
- )
71
-
72
49
def test_pass_compatible_types (self ):
73
50
"""
74
51
The request contains values that can be converted to expected
@@ -79,19 +56,13 @@ def test_pass_compatible_types(self):
79
56
TransactionHash (self .trytes1 ),
80
57
bytearray (self .trytes2 .encode ('ascii' )),
81
58
],
82
-
83
- 'tips' : [
84
- TransactionHash (self .trytes1 ),
85
- bytearray (self .trytes2 .encode ('ascii' )),
86
- ],
87
59
})
88
60
89
61
self .assertFilterPasses (filter_ )
90
62
self .assertDictEqual (
91
63
filter_ .cleaned_data ,
92
64
93
65
{
94
- 'tips' : [self .trytes1 , self .trytes2 ],
95
66
'transactions' : [self .trytes1 , self .trytes2 ],
96
67
},
97
68
)
@@ -116,12 +87,12 @@ def test_fail_unexpected_parameters(self):
116
87
{
117
88
'transactions' : [TransactionHash (self .trytes1 )],
118
89
119
- # I bring scientists, you bring a rock star.
120
- 'foo ' : 'bar' ,
90
+ # 'tips' deprecated in IRI 1.9.0
91
+ 'tips ' : [ self . trytes1 ]
121
92
},
122
93
123
94
{
124
- 'foo ' : [f .FilterMapper .CODE_EXTRA_KEY ],
95
+ 'tips ' : [f .FilterMapper .CODE_EXTRA_KEY ],
125
96
},
126
97
)
127
98
@@ -201,62 +172,18 @@ def test_fail_transactions_contents_invalid(self):
201
172
},
202
173
)
203
174
204
- def test_fail_tips_wrong_type (self ):
205
- """
206
- ``tips`` is not an array.
207
- """
208
- self .assertFilterErrors (
209
- {
210
- 'tips' : TransactionHash (self .trytes2 ),
211
-
212
- 'transactions' : [TransactionHash (self .trytes1 )],
213
- },
214
-
215
- {
216
- 'tips' : [f .Type .CODE_WRONG_TYPE ],
217
- },
218
- )
219
-
220
- def test_fail_tips_contents_invalid (self ):
221
- """
222
- ``tips`` contains invalid values.
223
- """
224
- self .assertFilterErrors (
225
- {
226
- 'tips' : [
227
- b'' ,
228
- True ,
229
- None ,
230
- b'not valid trytes' ,
231
-
232
- # This is actually valid; I just added it to make sure the
233
- # filter isn't cheating!
234
- TryteString (self .trytes1 ),
235
-
236
- 2130706433 ,
237
- b'9' * 82 ,
238
- ],
239
-
240
- 'transactions' : [TransactionHash (self .trytes1 )],
241
- },
242
-
243
- {
244
- 'tips.0' : [f .Required .CODE_EMPTY ],
245
- 'tips.1' : [f .Type .CODE_WRONG_TYPE ],
246
- 'tips.2' : [f .Required .CODE_EMPTY ],
247
- 'tips.3' : [Trytes .CODE_NOT_TRYTES ],
248
- 'tips.5' : [f .Type .CODE_WRONG_TYPE ],
249
- 'tips.6' : [Trytes .CODE_WRONG_FORMAT ],
250
- },
251
- )
252
-
253
175
254
176
class GetInclusionStatesCommandTestCase (TestCase ):
255
177
def setUp (self ):
256
178
super (GetInclusionStatesCommandTestCase , self ).setUp ()
257
179
258
180
self .adapter = MockAdapter ()
259
181
182
+ self .trytes1 = (
183
+ 'TESTVALUE9DONTUSEINPRODUCTION99999GCXWZZ'
184
+ 'ZKNRIZENRRXGPAGJOSSWQQOJDD9VGQRMEFCOIFLQB'
185
+ )
186
+
260
187
def test_wireup (self ):
261
188
"""
262
189
Verify that the command is wired up correctly.
@@ -270,11 +197,25 @@ def test_wireup(self):
270
197
api = Iota (self .adapter )
271
198
272
199
# Don't need to call with proper args here.
273
- response = api .get_inclusion_states ('transactions' , 'tips' )
200
+ response = api .get_inclusion_states ('transactions' )
274
201
275
202
self .assertTrue (mocked_command .called )
276
203
277
204
self .assertEqual (
278
205
response ,
279
206
'You found me!'
280
207
)
208
+
209
+ def test_fail_on_tips (self ):
210
+ """
211
+ Fail on provided 'tips' parameter.
212
+
213
+ Dperecated in IRI 1.9.0
214
+ """
215
+ api = Iota (self .adapter )
216
+
217
+ with self .assertRaises (TypeError ):
218
+ response = api .get_inclusion_states (
219
+ transactions = [self .trytes1 ],
220
+ tips = [self .trytes1 ]
221
+ )
0 commit comments