-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add `assert_cmd` to `dev-dependencies` in `Cargo.toml`
- Loading branch information
Showing
3 changed files
with
148 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,48 @@ | ||
struct Setup { | ||
cmd: assert_cmd::Command, | ||
email: String, | ||
password: String, | ||
} | ||
|
||
fn setup() -> Setup { | ||
let cmd = assert_cmd::Command::cargo_bin("jobcan").expect("Failed to find jobcan binary"); | ||
let email = std::env::var("JOBCAN_EMAIL").expect("JOBCAN_EMAIL is not set"); | ||
let password = std::env::var("JOBCAN_PASSWORD").expect("JOBCAN_PASSWORD is not set"); | ||
Setup { | ||
cmd, | ||
email, | ||
password, | ||
} | ||
} | ||
|
||
#[tokio::test] | ||
async fn process_of_getting_work_status_correctly() { | ||
let Setup { | ||
mut cmd, | ||
email, | ||
password, | ||
} = setup(); | ||
cmd.arg("status") | ||
.arg("--email") | ||
.arg(email) | ||
.arg("--password") | ||
.arg(password) | ||
.assert() | ||
.success(); | ||
} | ||
|
||
#[tokio::test] | ||
async fn process_of_getting_group_list_correctly() { | ||
let Setup { | ||
mut cmd, | ||
email, | ||
password, | ||
} = setup(); | ||
cmd.arg("list-groups") | ||
.arg("--email") | ||
.arg(email) | ||
.arg("--password") | ||
.arg(password) | ||
.assert() | ||
.success(); | ||
} |