@@ -1283,49 +1283,57 @@ mod tests {
1283
1283
1284
1284
#[ test]
1285
1285
fn snapshot_test_verification_level ( ) {
1286
- assert_json_snapshot ! ( VerificationLevel :: VerificationViolation ) ;
1287
- assert_json_snapshot ! ( VerificationLevel :: UnsignedDevice ) ;
1288
- assert_json_snapshot ! ( VerificationLevel :: None ( DeviceLinkProblem :: InsecureSource ) ) ;
1289
- assert_json_snapshot ! ( VerificationLevel :: None ( DeviceLinkProblem :: MissingDevice ) ) ;
1290
- assert_json_snapshot ! ( VerificationLevel :: UnverifiedIdentity ) ;
1286
+ with_settings ! ( { prepend_module_to_snapshot => false } , {
1287
+ assert_json_snapshot!( VerificationLevel :: VerificationViolation ) ;
1288
+ assert_json_snapshot!( VerificationLevel :: UnsignedDevice ) ;
1289
+ assert_json_snapshot!( VerificationLevel :: None ( DeviceLinkProblem :: InsecureSource ) ) ;
1290
+ assert_json_snapshot!( VerificationLevel :: None ( DeviceLinkProblem :: MissingDevice ) ) ;
1291
+ assert_json_snapshot!( VerificationLevel :: UnverifiedIdentity ) ;
1292
+ } ) ;
1291
1293
}
1292
1294
1293
1295
#[ test]
1294
1296
fn snapshot_test_verification_states ( ) {
1295
- assert_json_snapshot ! ( VerificationState :: Unverified ( VerificationLevel :: UnsignedDevice ) ) ;
1296
- assert_json_snapshot ! ( VerificationState :: Unverified (
1297
- VerificationLevel :: VerificationViolation
1298
- ) ) ;
1299
- assert_json_snapshot ! ( VerificationState :: Unverified ( VerificationLevel :: None (
1300
- DeviceLinkProblem :: InsecureSource ,
1301
- ) ) ) ;
1302
- assert_json_snapshot ! ( VerificationState :: Unverified ( VerificationLevel :: None (
1303
- DeviceLinkProblem :: MissingDevice ,
1304
- ) ) ) ;
1305
- assert_json_snapshot ! ( VerificationState :: Verified ) ;
1297
+ with_settings ! ( { prepend_module_to_snapshot => false } , {
1298
+ assert_json_snapshot!( VerificationState :: Unverified ( VerificationLevel :: UnsignedDevice ) ) ;
1299
+ assert_json_snapshot!( VerificationState :: Unverified (
1300
+ VerificationLevel :: VerificationViolation
1301
+ ) ) ;
1302
+ assert_json_snapshot!( VerificationState :: Unverified ( VerificationLevel :: None (
1303
+ DeviceLinkProblem :: InsecureSource ,
1304
+ ) ) ) ;
1305
+ assert_json_snapshot!( VerificationState :: Unverified ( VerificationLevel :: None (
1306
+ DeviceLinkProblem :: MissingDevice ,
1307
+ ) ) ) ;
1308
+ assert_json_snapshot!( VerificationState :: Verified ) ;
1309
+ } ) ;
1306
1310
}
1307
1311
1308
1312
#[ test]
1309
1313
fn snapshot_test_shield_states ( ) {
1310
- assert_json_snapshot ! ( ShieldState :: None ) ;
1311
- assert_json_snapshot ! ( ShieldState :: Red {
1312
- code: ShieldStateCode :: UnverifiedIdentity ,
1313
- message: "a message"
1314
- } ) ;
1315
- assert_json_snapshot ! ( ShieldState :: Grey {
1316
- code: ShieldStateCode :: AuthenticityNotGuaranteed ,
1317
- message: "authenticity of this message cannot be guaranteed" ,
1314
+ with_settings ! ( { prepend_module_to_snapshot => false } , {
1315
+ assert_json_snapshot!( ShieldState :: None ) ;
1316
+ assert_json_snapshot!( ShieldState :: Red {
1317
+ code: ShieldStateCode :: UnverifiedIdentity ,
1318
+ message: "a message"
1319
+ } ) ;
1320
+ assert_json_snapshot!( ShieldState :: Grey {
1321
+ code: ShieldStateCode :: AuthenticityNotGuaranteed ,
1322
+ message: "authenticity of this message cannot be guaranteed" ,
1323
+ } ) ;
1318
1324
} ) ;
1319
1325
}
1320
1326
1321
1327
#[ test]
1322
1328
fn snapshot_test_shield_codes ( ) {
1323
- assert_json_snapshot ! ( ShieldStateCode :: AuthenticityNotGuaranteed ) ;
1324
- assert_json_snapshot ! ( ShieldStateCode :: UnknownDevice ) ;
1325
- assert_json_snapshot ! ( ShieldStateCode :: UnsignedDevice ) ;
1326
- assert_json_snapshot ! ( ShieldStateCode :: UnverifiedIdentity ) ;
1327
- assert_json_snapshot ! ( ShieldStateCode :: SentInClear ) ;
1328
- assert_json_snapshot ! ( ShieldStateCode :: VerificationViolation ) ;
1329
+ with_settings ! ( { prepend_module_to_snapshot => false } , {
1330
+ assert_json_snapshot!( ShieldStateCode :: AuthenticityNotGuaranteed ) ;
1331
+ assert_json_snapshot!( ShieldStateCode :: UnknownDevice ) ;
1332
+ assert_json_snapshot!( ShieldStateCode :: UnsignedDevice ) ;
1333
+ assert_json_snapshot!( ShieldStateCode :: UnverifiedIdentity ) ;
1334
+ assert_json_snapshot!( ShieldStateCode :: SentInClear ) ;
1335
+ assert_json_snapshot!( ShieldStateCode :: VerificationViolation ) ;
1336
+ } ) ;
1329
1337
}
1330
1338
1331
1339
#[ test]
@@ -1341,7 +1349,9 @@ mod tests {
1341
1349
] ) ,
1342
1350
} ;
1343
1351
1344
- assert_json_snapshot ! ( info)
1352
+ with_settings ! ( { prepend_module_to_snapshot => false } , {
1353
+ assert_json_snapshot!( info)
1354
+ } ) ;
1345
1355
}
1346
1356
1347
1357
#[ test]
@@ -1397,7 +1407,7 @@ mod tests {
1397
1407
push_actions : Default :: default ( ) ,
1398
1408
} ;
1399
1409
1400
- with_settings ! ( { sort_maps =>true } , {
1410
+ with_settings ! ( { sort_maps => true , prepend_module_to_snapshot => false } , {
1401
1411
// We use directly the serde_json formatter here, because of a bug in insta
1402
1412
// not serializing custom BTreeMap key enum https://github.com/mitsuhiko/insta/issues/689
1403
1413
assert_json_snapshot! {
0 commit comments