From d21ceef797783f1208f648c04e67e302994888da Mon Sep 17 00:00:00 2001 From: Carson McManus Date: Sat, 15 Jan 2022 09:36:10 -0500 Subject: [PATCH] add sda compat unit test for no web cookie --- src/accountmanager.rs | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/accountmanager.rs b/src/accountmanager.rs index e389f7b..a9a0915 100644 --- a/src/accountmanager.rs +++ b/src/accountmanager.rs @@ -482,4 +482,38 @@ mod tests { .account_name ); } + + #[test] + fn test_sda_compatibility_no_webcookie() { + let path = Path::new("src/fixtures/maFiles/compat/no-webcookie/manifest.json"); + assert!(path.is_file()); + let result = Manifest::load(path); + assert!(matches!(result, Ok(_))); + let mut manifest = result.unwrap(); + assert!(matches!(manifest.entries.last().unwrap().encryption, None)); + assert!(matches!(manifest.load_accounts(&None), Ok(_))); + assert_eq!( + manifest.entries.last().unwrap().account_name, + manifest + .accounts + .last() + .unwrap() + .lock() + .unwrap() + .account_name + ); + assert_eq!( + manifest + .accounts + .last() + .unwrap() + .lock() + .unwrap() + .session + .as_ref() + .unwrap() + .web_cookie, + None + ); + } }