aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/args.rs2
-rw-r--r--src/tests/config.rs17
2 files changed, 18 insertions, 1 deletions
diff --git a/src/args.rs b/src/args.rs
index 91bddc5..57e9743 100644
--- a/src/args.rs
+++ b/src/args.rs
@@ -172,7 +172,7 @@ struct ConfigSetArgs {
#[structopt(short = "o", long)]
otp_pin: bool,
/// Allows one-time password generation without PIN
- #[structopt(short = "O", long, conflicts_with("otp_pin"))]
+ #[structopt(short = "O", long, conflicts_with("otp-pin"))]
no_otp_pin: bool,
}
diff --git a/src/tests/config.rs b/src/tests/config.rs
index 728fdbd..fa311d5 100644
--- a/src/tests/config.rs
+++ b/src/tests/config.rs
@@ -19,6 +19,23 @@
use super::*;
+#[test]
+fn mutually_exclusive_set_options() {
+ fn test(option1: &str, option2: &str) {
+ let (rc, out, err) = Nitrocli::new().run(&["config", "set", option1, option2]);
+
+ assert_ne!(rc, 0);
+ assert_eq!(out, b"");
+
+ let err = String::from_utf8(err).unwrap();
+ assert!(err.contains("cannot be used with"), err);
+ }
+
+ test("-c", "-C");
+ test("-o", "-O");
+ test("-s", "-S");
+}
+
#[test_device]
fn get(model: nitrokey::Model) -> crate::Result<()> {
let re = regex::Regex::new(