summaryrefslogtreecommitdiff
path: root/wpa-psk-cli/tests/cli.rs
blob: 47fab8d880e66dee14256320cd8db7421510354a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use std::process::Command;

use assert_cmd::prelude::*;

#[test]
fn valid() {
    let mut cmd = Command::cargo_bin("wpa-psk").unwrap();
    cmd.arg("home")
        .arg("0123-4567-89")
        .assert()
        .success()
        .stdout("0x150c047b6fad724512a17fa431687048ee503d14c1ea87681d4f241beb04f5ee\n");
}

#[test]
fn passphrase_too_short() {
    let mut cmd = Command::cargo_bin("wpa-psk").unwrap();
    cmd.arg("bar")
        .arg("2short")
        .assert()
        .failure()
        .stderr("passphrase must have at least 8 bytes\n");
}

#[test]
fn force() {
    let mut cmd = Command::cargo_bin("wpa-psk").unwrap();
    cmd.arg("--force")
        .arg("bar")
        .arg("2short")
        .assert()
        .success()
        .stdout("0xcb5de4e4d23b2ab0bf5b9ba0fe8132c1e2af3bb52298ec801af8ad520cea3437\n");
}
Generated by cgit. See skreutz.com for my tech blog and contact information.