@@ -175,7 +175,42 @@ def test_2_micro_resource(self):
175
175
time .sleep (0.5 )
176
176
self .assertEqual (l1 .status , RNS .Link .CLOSED )
177
177
178
- def test_3_small_resource (self ):
178
+ def test_3_mini_resource (self ):
179
+ init_rns (self )
180
+ print ("" )
181
+ print ("Mini resource test" )
182
+
183
+ # TODO: Load this from public bytes only
184
+ id1 = RNS .Identity .from_bytes (bytes .fromhex (fixed_keys [0 ][0 ]))
185
+ self .assertEqual (id1 .hash , bytes .fromhex (fixed_keys [0 ][1 ]))
186
+
187
+ dest = RNS .Destination (id1 , RNS .Destination .OUT , RNS .Destination .SINGLE , APP_NAME , "link" , "establish" )
188
+
189
+ self .assertEqual (dest .hash , bytes .fromhex ("6bbe8b43a9842b77867ad99fd090fff3" ))
190
+
191
+ l1 = RNS .Link (dest )
192
+ time .sleep (0.5 )
193
+ self .assertEqual (l1 .status , RNS .Link .ACTIVE )
194
+
195
+ resource_timeout = 120
196
+ resource_size = 256 * 1000
197
+ data = os .urandom (resource_size )
198
+ print ("Sending " + self .size_str (resource_size )+ " resource..." )
199
+ resource = RNS .Resource (data , l1 , timeout = resource_timeout )
200
+ start = time .time ()
201
+
202
+ while resource .status < RNS .Resource .COMPLETE :
203
+ time .sleep (0.01 )
204
+
205
+ t = time .time () - start
206
+ self .assertEqual (resource .status , RNS .Resource .COMPLETE )
207
+ print ("Resource completed at " + self .size_str (resource_size / t , "b" )+ "ps" )
208
+
209
+ l1 .teardown ()
210
+ time .sleep (0.5 )
211
+ self .assertEqual (l1 .status , RNS .Link .CLOSED )
212
+
213
+ def test_4_small_resource (self ):
179
214
init_rns (self )
180
215
print ("" )
181
216
print ("Small resource test" )
@@ -210,7 +245,7 @@ def test_3_small_resource(self):
210
245
self .assertEqual (l1 .status , RNS .Link .CLOSED )
211
246
212
247
213
- def test_4_medium_resource (self ):
248
+ def test_5_medium_resource (self ):
214
249
if RNS .Cryptography .backend () == "internal" :
215
250
print ("Skipping medium resource test..." )
216
251
return
@@ -248,7 +283,7 @@ def test_4_medium_resource(self):
248
283
time .sleep (0.5 )
249
284
self .assertEqual (l1 .status , RNS .Link .CLOSED )
250
285
251
- def test_5_large_resource (self ):
286
+ def test_6_large_resource (self ):
252
287
if RNS .Cryptography .backend () == "internal" :
253
288
print ("Skipping large resource test..." )
254
289
return
0 commit comments