Implement iPhone TOTP tab and Watch sharing
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#![forbid(unsafe_code)]
|
||||
|
||||
use std::{error::Error, ffi::OsStr, fs, path::Path, time::Duration};
|
||||
use std::{collections::BTreeSet, error::Error, ffi::OsStr, fs, path::Path, time::Duration};
|
||||
|
||||
use ironstorage::presentation::DEFAULT_CLIPBOARD_TIMEOUT;
|
||||
use ironstorage::{
|
||||
@@ -8,6 +8,7 @@ use ironstorage::{
|
||||
config::{ConfigError, ConfigLoader, EditorSource},
|
||||
desktop::DesktopStorage,
|
||||
mobile::MobileTab,
|
||||
repository::EntryPath,
|
||||
};
|
||||
use tempfile::TempDir;
|
||||
|
||||
@@ -64,7 +65,6 @@ fn explicit_relative_configuration_resolves_deterministically() -> TestResult {
|
||||
let config = fixture
|
||||
.loader()
|
||||
.load(Some(Path::new("config/config.toml")))?;
|
||||
|
||||
assert_eq!(config.source(), fs::canonicalize(fixture.explicit_path())?);
|
||||
assert_eq!(
|
||||
config.vault(),
|
||||
@@ -98,6 +98,33 @@ fn explicit_relative_configuration_resolves_deterministically() -> TestResult {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn watch_totp_selection_persists_only_in_application_configuration() -> TestResult {
|
||||
let fixture = ConfigurationFixture::new()?;
|
||||
fixture.write_explicit(fixture.valid_contents())?;
|
||||
let config = fixture
|
||||
.loader()
|
||||
.load(Some(Path::new("config/config.toml")))?;
|
||||
let stale = fixture
|
||||
.loader()
|
||||
.load(Some(Path::new("config/config.toml")))?;
|
||||
let selected = BTreeSet::from([
|
||||
EntryPath::parse("otp/personal")?,
|
||||
EntryPath::parse("otp/work")?,
|
||||
]);
|
||||
|
||||
config.update_watch_shared_totp_entries(&selected)?;
|
||||
stale.update_mobile_tab(MobileTab::Totp)?;
|
||||
let reloaded = fixture
|
||||
.loader()
|
||||
.load(Some(Path::new("config/config.toml")))?;
|
||||
|
||||
assert_eq!(reloaded.watch_shared_totp_entries(), &selected);
|
||||
assert_eq!(reloaded.mobile_tab(), MobileTab::Totp);
|
||||
assert!(!fixture.temporary.path().join("cwd/vault").exists());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn authentication_timeout_defaults_overrides_and_rejects_invalid_values() -> TestResult {
|
||||
let fixture = ConfigurationFixture::new()?;
|
||||
|
||||
Reference in New Issue
Block a user