add test for manifest with 2 accounts

This commit is contained in:
Carson McManus 2022-02-21 13:23:59 -05:00
parent 00ea8dca71
commit 0bdaa60bbf
4 changed files with 30 additions and 0 deletions

View file

@ -641,4 +641,31 @@ mod tests {
);
Ok(())
}
#[test]
fn test_sda_compatibility_2() -> anyhow::Result<()> {
let path = Path::new("src/fixtures/maFiles/compat/2-account/manifest.json");
assert!(path.is_file());
let mut manifest = Manifest::load(path)?;
assert!(matches!(manifest.entries.last().unwrap().encryption, None));
manifest.load_accounts()?;
let account_name = manifest.entries[0].account_name.clone();
let account = manifest.get_account(&account_name)?;
assert_eq!(account_name, account.lock().unwrap().account_name);
assert_eq!(account.lock().unwrap().revocation_code, "R12345");
assert_eq!(
account.lock().unwrap().session.as_ref().unwrap().steam_id,
1234
);
let account_name = manifest.entries[1].account_name.clone();
let account = manifest.get_account(&account_name)?;
assert_eq!(account_name, account.lock().unwrap().account_name);
assert_eq!(account.lock().unwrap().revocation_code, "R56789");
assert_eq!(
account.lock().unwrap().session.as_ref().unwrap().steam_id,
5678
);
Ok(())
}
}

View file

@ -0,0 +1 @@
{"shared_secret":"zvIayp3JPvtvX/QGHqsqKBk/44s=","serial_number":"kljasfhds","revocation_code":"R12345","uri":"otpauth://totp/Steam:example?secret=ASDF&issuer=Steam","server_time":1602522478,"account_name":"example","token_gid":"jkkjlhkhjgf","identity_secret":"kjsdlwowiqe=","secret_1":"sklduhfgsdlkjhf=","status":1,"device_id":"android:99d2ad0e-4bad-4247-b111-26393aae0be3","fully_enrolled":true,"Session":{"SessionID":"a;lskdjf","SteamLogin":"983498437543","SteamLoginSecure":"dlkjdsl;j%7C%32984730298","WebCookie":";lkjsed;klfjas98093","OAuthToken":"asdk;lf;dsjlkfd","SteamID":1234}}

View file

@ -0,0 +1 @@
{"shared_secret":"zvIayp3JPvtvX/QGHqsqKBk/44s=","serial_number":"kljasfhds","revocation_code":"R56789","uri":"otpauth://totp/Steam:example?secret=ASDF&issuer=Steam","server_time":1602522478,"account_name":"example2","token_gid":"jkkjlhkhjgf","identity_secret":"kjsdlwowiqe=","secret_1":"sklduhfgsdlkjhf=","status":1,"device_id":"android:99d2ad0e-4bad-4247-b111-26393aae0be3","fully_enrolled":true,"Session":{"SessionID":"a;lskdjf","SteamLogin":"983498437543","SteamLoginSecure":"dlkjdsl;j%7C%32984730298","WebCookie":";lkjsed;klfjas98093","OAuthToken":"asdk;lf;dsjlkfd","SteamID":5678}}

View file

@ -0,0 +1 @@
{"encrypted":false,"first_run":true,"entries":[{"encryption_iv":null,"encryption_salt":null,"filename":"1234.maFile","steamid":1234}, {"encryption_iv":null,"encryption_salt":null,"filename":"5678.maFile","steamid":5678}],"periodic_checking":false,"periodic_checking_interval":5,"periodic_checking_checkall":false,"auto_confirm_market_transactions":false,"auto_confirm_trades":false}