Fix identity tests

finchie
Sep 26, 2022, 4:33 AM
6FRPUHWKBAWIYN6B6YDFQG2SFWZ6MBBYOYXFUN6DRZ4HPDSKFANQC

Dependencies

  • [2] FOCBVLOU Implement testing for identity management
  • [3] KKNMDXAI Tweak identity subcommand
  • [4] EEBKW7VT Keys and identities
  • [5] OU6JOR3C Add path filtering for log, add json output for log
  • [6] 5BB266P6 Optional colours in the global config file
  • [7] NAUECZW3 Fixing the map between keys and identities
  • [8] FVQYZQFL Create dialoguer themes based on global config
  • [9] 4OJWMSOW Fully replace crate::Identity
  • [10] 4KJ45IJL Implement new identity management
  • [11] SV2PROHV
  • [12] A3RM526Y Integrating identity malleability
  • [*] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).

Change contents

  • edit in pijul/tests/identity.rs at line 24
    [2.599]
    [2.599]
    None,
  • edit in pijul/tests/identity.rs at line 66
    [2.1724]
    [2.1724]
    Some(Interaction::new(
    prompt::SELECT_KEY,
    InteractionType::Input(default::SSH.to_string()),
    )),
  • edit in pijul/tests/identity.rs at line 96
    [2.2341]
    [2.2341]
    None,
  • edit in pijul/tests/identity.rs at line 123
    [2.2959]
    [2.2959]
    None,
  • edit in pijul/tests/identity.rs at line 144
    [2.3363]
    [2.3363]
    None,
  • edit in pijul/tests/identity.rs at line 165
    [2.3771]
    [2.3771]
    None,
  • edit in pijul/tests/identity.rs at line 198
    [2.4646]
    [2.4646]
    None,
  • edit in pijul/tests/identity.rs at line 210
    [2.4850]
    [2.4850]
    None,
  • edit in pijul/tests/identity.rs at line 270
    [2.6741]
    [2.6741]
    Some(Interaction::new(
    prompt::SELECT_KEY,
    InteractionType::Input(default::SSH.to_string()),
    )),
  • edit in pijul/tests/identity.rs at line 289
    [2.7036]
    [2.7036]
    None,
  • edit in pijul/tests/identity.rs at line 310
    [2.7406]
    [2.7406]
    None,
  • edit in pijul/tests/identity.rs at line 332
    [2.7781]
    [2.7781]
    None,
  • edit in pijul/tests/identity.rs at line 353
    [2.8294]
    [2.8294]
    None,
  • edit in pijul/tests/identity.rs at line 375
    [2.8671]
    [2.8671]
    None,
  • edit in pijul/tests/identity.rs at line 396
    [2.9184]
    [2.9184]
    None,
  • edit in pijul/tests/identity.rs at line 418
    [2.9565]
    [2.9565]
    None,
  • edit in pijul/tests/identity.rs at line 445
    [2.10333]
    [2.10333]
    None,
  • replacement in pijul/tests/identity.rs at line 459
    [2.10567][2.10567:10590]()
    "new_minimal",
    [2.10567]
    [2.10590]
    "remove",
  • edit in pijul/tests/identity.rs at line 467
    [2.10701]
    [2.10701]
    None,
  • edit in pijul/tests/common/identity.rs at line 20
    [2.18395]
    [2.18395]
    pub const SSH: &str = ""; // Just confirm the first item in SSH option list
  • replacement in pijul/tests/common/identity.rs at line 25
    [2.18469][2.18469:18517]()
    pub const FULL_NAME: &str = "Display name";
    [2.18469]
    [2.18517]
    pub const DISPLAY_NAME: &str = "Display name";
  • replacement in pijul/tests/common/identity.rs at line 30
    [2.18729][2.18729:18783]()
    pub const PASSWORD: &str = "Secret key password";
    [2.18729]
    [2.18783]
    pub const PASSWORD: &str = "New password";
  • edit in pijul/tests/common/identity.rs at line 32
    [2.18843]
    [2.18843]
    pub const SELECT_KEY: &str = "Select key";
  • edit in pijul/tests/common/identity.rs at line 35
    [2.18866]
    [2.18866]
    pub const SSH: &str = "Do you want to change the default SSH key?";
    pub const ENCRYPTION: &str = "Do you want to change the encryption?";
  • edit in pijul/tests/common/identity.rs at line 39
    [2.19017][2.19017:19095]()
    pub const ENCRYPTION: &str = "Do you want to change the encryption?";
  • replacement in pijul/tests/common/identity.rs at line 56
    [2.19321][2.19321:19356]()
    pub full_name: Option<String>,
    [2.19321]
    [2.19356]
    pub display_name: Option<String>,
  • edit in pijul/tests/common/identity.rs at line 62
    [2.19541]
    [2.19541]
    pub key_path: Option<Interaction>,
  • edit in pijul/tests/common/identity.rs at line 76
    [2.19890]
    [2.19890]
    key_path: Option<Interaction>,
  • replacement in pijul/tests/common/identity.rs at line 82
    [2.20070][2.20070:20093]()
    full_name,
    [2.20070]
    [2.20093]
    display_name: full_name,
  • edit in pijul/tests/common/identity.rs at line 88
    [2.20201]
    [2.20201]
    key_path,
  • replacement in pijul/tests/common/identity.rs at line 139
    [2.21740][2.21740:21785]()
    self.full_name.as_ref().map_or_else(
    [2.21740]
    [2.21785]
    self.display_name.as_ref().map_or_else(
  • replacement in pijul/tests/common/identity.rs at line 148
    [2.22075][2.22075:22144]()
    toml_data.get("name").unwrap().as_str().unwrap()
    [2.22075]
    [2.22144]
    toml_data.get("display_name").unwrap().as_str().unwrap()
  • replacement in pijul/tests/common/identity.rs at line 174
    [2.22969][2.22969:23039]()
    toml_data.get("login").unwrap().as_str().unwrap()
    [2.22969]
    [2.23039]
    toml_data.get("username").unwrap().as_str().unwrap()
  • replacement in pijul/tests/common/identity.rs at line 251
    [2.25428][2.25428:25480]()
    pijul_cmd.arg("--no-prompt").arg("--name");
    [2.25428]
    [2.25480]
    pijul_cmd.arg("--no-prompt");
  • replacement in pijul/tests/common/identity.rs at line 258
    [2.25657][2.25657:25815]()
    pijul_cmd
    .arg(&old_name)
    .arg("--new-name")
    .arg(self.id_name.get_input(valid));
    [2.25657]
    [2.25815]
    pijul_cmd.arg(&old_name);
    let new_name = self.id_name.get_input(valid);
    if old_name != &new_name {
    pijul_cmd.arg("--new-name").arg(new_name);
    }
  • replacement in pijul/tests/common/identity.rs at line 270
    [2.25939][2.25939:25997]()
    if let Some(full_name) = self.full_name.clone() {
    [2.25939]
    [2.25997]
    if let Some(full_name) = self.display_name.clone() {
  • edit in pijul/tests/common/identity.rs at line 303
    [2.27176]
    [2.27176]
    // Interatction tree
    // ├── Identity name
    // ├── Display name
    // ├── Email
    // ├── Encryption
    // │ ├── Password
    // │ └── Confirm
    // ├── Expiry
    // │ └── Date
    // └── Link to remote
    // ├── Username
    // ├── Origin
    // └── Default SSH key
    // └── Key path
  • edit in pijul/tests/common/identity.rs at line 318
    [2.27230]
    [2.27230]
    // Interaction: ID name
  • replacement in pijul/tests/common/identity.rs at line 322
    [2.27277][2.27277:27418]()
    if let Some(full_name) = self.full_name.clone() {
    Interaction::new(prompt::FULL_NAME, InteractionType::Input(full_name))
    [2.27277]
    [2.27418]
    // Interaction: Display name
    if let Some(display_name) = self.display_name.clone() {
    Interaction::new(prompt::DISPLAY_NAME, InteractionType::Input(display_name))
  • replacement in pijul/tests/common/identity.rs at line 327
    [2.27477][2.27477:27564]()
    Interaction::new(prompt::FULL_NAME, InteractionType::Input(String::new()))
    [2.27477]
    [2.27564]
    Interaction::new(prompt::DISPLAY_NAME, InteractionType::Input(String::new()))
  • edit in pijul/tests/common/identity.rs at line 331
    [2.27617]
    [2.27617]
    // Interaction: Email
  • edit in pijul/tests/common/identity.rs at line 339
    [2.27837]
    [2.27837]
    // Interaction: Encryption
    Interaction::new(
    format!(
    "{} (Current status: not encrypted)",
    prompt::confirm::ENCRYPTION
    ),
    InteractionType::Confirm(self.password.is_some()),
    )
    .interact(&mut session)?;
    if let Some(password) = self.password.clone() {
    password.interact(&mut session)?;
    }
  • edit in pijul/tests/common/identity.rs at line 353
    [2.27838]
    [2.27838]
    // Interaction: Expiry
  • replacement in pijul/tests/common/identity.rs at line 363
    [2.28152][2.28152:28225]()
    let remote_data = self.login.is_some() || self.origin.is_some();
    [2.28152]
    [2.28225]
    // Interaction: Link remote
    let remote_data = self.login.is_some() || self.origin.is_some() || self.key_path.is_some();
  • edit in pijul/tests/common/identity.rs at line 385
    [2.29027][2.29027:29037]()
    }
  • replacement in pijul/tests/common/identity.rs at line 386
    [2.29038][2.29038:29407]()
    Interaction::new(
    format!(
    "{} (Current status: not encrypted)",
    prompt::confirm::ENCRYPTION
    ),
    InteractionType::Confirm(self.password.is_some()),
    )
    .interact(&mut session)?;
    if let Some(password) = self.password.clone() {
    password.interact(&mut session)?;
    [2.29038]
    [2.29407]
    Interaction::new(
    prompt::confirm::SSH,
    InteractionType::Confirm(self.key_path.is_some()),
    )
    .interact(&mut session)?;
    if let Some(key_path) = self.key_path.clone() {
    key_path.interact(&mut session)?;
    }
  • replacement in pijul/src/identity/repair.rs at line 292
    [4.1595][4.1595:1635]()
    author.user_name = identity
    [4.1595]
    [4.14417]
    author.username = identity
  • replacement in pijul/src/identity/repair.rs at line 294
    [4.14443][4.1636:1718]()
    .map_or_else(String::new, |x| x.config.author.user_name.clone());
    [4.14443]
    [4.14646]
    .map_or_else(String::new, |x| x.config.author.username.clone());
  • replacement in pijul/src/identity/mod.rs at line 286
    [4.19976][4.8084:8153]()
    let has_username = !self.config.author.user_name.is_empty();
    [4.19976]
    [4.8153]
    let has_username = !self.config.author.username.is_empty();
  • replacement in pijul/src/identity/mod.rs at line 292
    [4.20227][4.8218:8290]()
    self.config.author.user_name, self.config.author.origin
    [4.20227]
    [4.20285]
    self.config.author.username, self.config.author.origin
  • replacement in pijul/src/identity/mod.rs at line 295
    [4.20333][4.8291:8357]()
    Some(format!(" [@{}]", self.config.author.user_name))
    [4.20333]
    [4.20390]
    Some(format!(" [@{}]", self.config.author.username))
  • edit in pijul/src/identity/create.rs at line 86
    [4.9519][4.9519:10005]()
    "Would you like to change the default SSH key? (Current key: {})",
    if let Some(path) = &self.config.key_path {
    format!("{path:#?}")
    } else {
    String::from("none")
    }
    ))
    .default(false)
    .interact()?
    {
    new_identity.prompt_ssh().await?;
    }
    if Confirm::with_theme(config.as_ref())
    .with_prompt(&format!(
  • edit in pijul/src/identity/create.rs at line 109
    [4.10782]
    [4.10782]
    } else {
    // The user wants an 'offline' identity, so make sure not to store login info
    new_identity.config.key_path = None;
    new_identity.config.author.username = String::new();
    new_identity.config.author.origin = String::new();
  • replacement in pijul/src/identity/create.rs at line 161
    [4.12545][4.12545:12619]()
    self.config.author.user_name = Input::with_theme(config.as_ref())
    [4.12545]
    [4.12619]
    self.config.author.username = Input::with_theme(config.as_ref())
  • replacement in pijul/src/identity/create.rs at line 164
    [4.12704][4.12704:12766]()
    .with_initial_text(&self.config.author.user_name)
    [4.12704]
    [4.12766]
    .with_initial_text(&self.config.author.username)
  • edit in pijul/src/identity/create.rs at line 175
    [4.13093]
    [4.13093]
    if Confirm::with_theme(config.as_ref())
    .with_prompt(&format!(
    "Do you want to change the default SSH key? (Current key: {})",
    if let Some(path) = &self.config.key_path {
    format!("{path:#?}")
    } else {
    String::from("none")
    }
    ))
    .default(false)
    .interact()
    .unwrap()
    {
    self.prompt_ssh().await?;
    }
  • replacement in pijul/src/identity/create.rs at line 285
    [4.37098][4.13744:13814]()
    &self.config.author.user_name, &self.config.author.origin
    [4.37098]
    [4.37154]
    &self.config.author.username, &self.config.author.origin
  • replacement in pijul/src/config.rs at line 22
    [4.182][4.14271:14349]()
    // Older versions called this 'name', but 'user_name' is more descriptive
    [4.182]
    [4.14349]
    // Older versions called this 'name', but 'username' is more descriptive
  • replacement in pijul/src/config.rs at line 24
    [4.14429][4.14429:14456]()
    pub user_name: String,
    [4.14429]
    [4.14456]
    pub username: String,
  • replacement in pijul/src/config.rs at line 39
    [4.14987][4.14987:15025]()
    user_name: String::new(),
    [4.14987]
    [4.15025]
    username: String::new(),
  • replacement in pijul/src/commands/log.rs at line 396
    [4.15914][4.15914:15987]()
    e.insert(id.config.author.user_name)
    [4.15914]
    [4.15987]
    e.insert(id.config.author.username)
  • replacement in pijul/src/commands/log.rs at line 402
    [4.16291][4.16291:16362]()
    id.config.author.user_name
    [4.16291]
    [4.16362]
    id.config.author.username
  • replacement in pijul/src/commands/log.rs at line 408
    [4.16599][4.16599:16671]()
    id.config.author.user_name,
    [4.16599]
    [4.16671]
    id.config.author.username,
  • replacement in pijul/src/commands/identity.rs at line 74
    [4.42808][4.42808:42895]()
    .args(&["display-name", "email", "expiry", "username", "remote", "name"]),
    [4.42773]
    [4.42895]
    .args(&["display-name", "email", "expiry", "username", "remote", "name", "password"]),
  • replacement in pijul/src/commands/identity.rs at line 96
    [4.43775][4.43775:43861]()
    #[clap(long = "name", value_parser = name_does_not_exist, display_order = 3)]
    [4.43775]
    [4.43861]
    #[clap(value_parser = name_does_not_exist)]
  • replacement in pijul/src/commands/identity.rs at line 110
    [4.44349][4.44349:44440]()
    .args(&["display-name", "email", "new-name", "expiry", "username", "remote"]),
    [4.44314]
    [4.44440]
    .args(&["display-name", "email", "new-name", "expiry", "username", "remote", "password"]),
  • replacement in pijul/src/commands/identity.rs at line 114
    [4.44519][3.0:78]()
    #[clap(group("name"), value_parser = name_exists, display_order = 2)]
    [4.44519]
    [4.44612]
    #[clap(group("name"), value_parser = name_exists)]
  • replacement in pijul/src/commands/identity.rs at line 208
    [4.47648][4.47648:47700]()
    .with_prompt("Secret key password")
    [4.47648]
    [4.47700]
    .with_prompt("New password")
  • replacement in pijul/src/commands/identity.rs at line 223
    [4.17085][4.17085:17162]()
    user_name: login.unwrap_or(default.config.author.user_name),
    [4.17085]
    [4.17162]
    username: login.unwrap_or(default.config.author.username),
  • replacement in pijul/src/commands/identity.rs at line 305
    [4.51088][4.18110:18194]()
    let username = if identity.config.author.user_name.is_empty() {
    [4.51088]
    [4.18194]
    let username = if identity.config.author.username.is_empty() {
  • replacement in pijul/src/commands/identity.rs at line 308
    [4.51243][4.18235:18293]()
    &identity.config.author.user_name
    [4.51243]
    [4.51291]
    &identity.config.author.username