@@ -213,24 +213,25 @@ mod test {
213213 item. delete ( ) . unwrap ( ) ;
214214 }
215215
216- #[ tokio:: test]
217- async fn should_get_item_by_path ( ) {
218- let ss = SecretService :: connect ( EncryptionType :: Plain ) . unwrap ( ) ;
219- let collection = ss. get_default_collection ( ) . unwrap ( ) ;
220- let item = create_test_default_item ( & collection) ;
221-
222- // Set label to test and check
223- item. set_label ( "Tester" ) . unwrap ( ) ;
224- let label = item. get_label ( ) . unwrap ( ) ;
225- assert_eq ! ( label, "Tester" ) ;
226-
227- // get item by path and check label
228- let path = item. item_path . clone ( ) ;
229- let item_prime = ss. get_item_by_path ( path) . unwrap ( ) ;
230- let label_prime = item_prime. get_label ( ) . unwrap ( ) ;
231- assert_eq ! ( label_prime, label) ;
232-
233- item. delete ( ) . unwrap ( ) ;
216+ #[ test]
217+ fn should_get_item_by_path ( ) {
218+ let path: OwnedObjectPath ;
219+ // first create the item on one blocking call, set its label, and get its path
220+ {
221+ let ss = SecretService :: connect ( EncryptionType :: Plain ) . unwrap ( ) ;
222+ let collection = ss. get_default_collection ( ) . unwrap ( ) ;
223+ let item = create_test_default_item ( & collection) ;
224+ item. set_label ( "Tester" ) . unwrap ( ) ;
225+ path = item. item_path . clone ( ) ;
226+ }
227+ // now get the item by path on another blocking call, check its label, and delete it
228+ {
229+ let ss = SecretService :: connect ( EncryptionType :: Plain ) . unwrap ( ) ;
230+ let item = ss. get_item_by_path ( path) . unwrap ( ) ;
231+ let label = item. get_label ( ) . unwrap ( ) ;
232+ assert_eq ! ( label, "Tester" ) ;
233+ item. delete ( ) . unwrap ( ) ;
234+ }
234235 }
235236
236237 #[ test]
0 commit comments