-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: Fix tests calling nonexistent or old binary build (#87)
- Loading branch information
Showing
2 changed files
with
61 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
use assert_cmd::Command; | ||
|
||
#[test] | ||
fn parse_input() { | ||
let args_permutations = vec![ | ||
vec![ | ||
"--account=user", | ||
"--token=ghs_sSIL4kMdtzfbfDdm1MC1OU2q5DbRqA3eSszT", | ||
"--image-names=foo", | ||
"--image-tags=one", | ||
"--shas-to-skip=", | ||
"--keep-n-most-recent=0", | ||
"--tag-selection=tagged", | ||
"--timestamp-to-use=updated_at", | ||
"--cut-off=1w", | ||
"--dry-run=true", | ||
], | ||
vec![ | ||
"--account=acme", | ||
"--token=ghp_sSIL4kMdtzfbfDdm1MC1OU2q5DbRqA3eSszT", | ||
"--image-names=\"foo bar\"", | ||
"--image-tags=\"one two\"", | ||
"--shas-to-skip=", | ||
"--keep-n-most-recent=10", | ||
"--tag-selection=untagged", | ||
"--timestamp-to-use=created_at", | ||
"--cut-off=1d", | ||
"--dry-run=true", | ||
], | ||
vec![ | ||
"--account=foo", | ||
"--token=ghp_sSIL4kMdtzfbfDdm1MC1OU2q5DbRqA3eSszT", | ||
"--image-names=\"foo, bar\"", | ||
"--image-tags=\"one, two\"", | ||
"--shas-to-skip=''", | ||
"--keep-n-most-recent=999", | ||
"--tag-selection=both", | ||
"--timestamp-to-use=updated_at", | ||
"--cut-off=1h", | ||
"--dry-run=true", | ||
], | ||
vec![ | ||
"--account=$;\u{b}\n₭↭", | ||
"--token=ghp_sSIL4kMdtzfbfDdm1MC1OU2q5DbRqA3eSszT", | ||
"--image-names=\"foo, bar\"", | ||
"--image-tags=\"one, two\"", | ||
"--shas-to-skip=''", | ||
"--keep-n-most-recent=2", | ||
"--tag-selection=both", | ||
"--timestamp-to-use=updated_at", | ||
"--cut-off=1h", | ||
"--dry-run=true", | ||
], | ||
]; | ||
|
||
for args in args_permutations { | ||
let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).expect("Failed to load binary"); | ||
|
||
cmd.env("CRP_TEST", "true").args(args).assert().success(); | ||
} | ||
} |