Skip to content

Commit b03ff1a

Browse files
committed
fix cli test
1 parent 8894703 commit b03ff1a

10 files changed

+30
-29
lines changed

cli/tests/cli/copy_and_paste_cli_test.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::helper::{generate_random_key_nonce, CliTestContext};
66
#[tokio::test]
77
async fn test_copy_and_paste_command(ctx: &mut CliTestContext) {
88
let (file, expected_content) = ctx.create_dummy_file().await.unwrap();
9-
let url_path = Command::cargo_bin("cli")
9+
let url_path = Command::cargo_bin("pf-cli")
1010
.unwrap()
1111
.args([
1212
"--server-addr",
@@ -23,7 +23,7 @@ async fn test_copy_and_paste_command(ctx: &mut CliTestContext) {
2323
.unwrap()
2424
.stdout;
2525
let url_path = std::str::from_utf8(&url_path).unwrap().trim();
26-
let actual_content = Command::cargo_bin("cli")
26+
let actual_content = Command::cargo_bin("pf-cli")
2727
.unwrap()
2828
.args([
2929
"--server-addr",
@@ -44,7 +44,7 @@ async fn test_copy_and_paste_command(ctx: &mut CliTestContext) {
4444
async fn test_copy_encrypt_and_paste_decrypt_command(ctx: &mut CliTestContext) {
4545
let key_nonce = generate_random_key_nonce();
4646
let (file, expected_content) = ctx.create_dummy_file().await.unwrap();
47-
let url_path = Command::cargo_bin("cli")
47+
let url_path = Command::cargo_bin("pf-cli")
4848
.unwrap()
4949
.args([
5050
"--server-addr",
@@ -63,7 +63,7 @@ async fn test_copy_encrypt_and_paste_decrypt_command(ctx: &mut CliTestContext) {
6363
.unwrap()
6464
.stdout;
6565
let url_path = std::str::from_utf8(&url_path).unwrap().trim();
66-
let actual_content = Command::cargo_bin("cli")
66+
let actual_content = Command::cargo_bin("pf-cli")
6767
.unwrap()
6868
.args([
6969
"--server-addr",

cli/tests/cli/delete_cli_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::helper::CliTestContext;
66
#[tokio::test]
77
async fn test_delete_command(ctx: &mut CliTestContext) {
88
let (url_path, _) = ctx.upload_dummy_file().await.unwrap();
9-
Command::cargo_bin("cli")
9+
Command::cargo_bin("pf-cli")
1010
.unwrap()
1111
.args([
1212
"--server-addr",

cli/tests/cli/download_cli_test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::helper::CliTestContext;
77
async fn test_download_command_to_the_destination_file(ctx: &mut CliTestContext) {
88
let (url_path, expected_content) = ctx.upload_dummy_file().await.unwrap();
99
let destination_file_path = ctx.workspace.join("destination_file.txt");
10-
Command::cargo_bin("cli")
10+
Command::cargo_bin("pf-cli")
1111
.unwrap()
1212
.args([
1313
"--server-addr",
@@ -32,7 +32,7 @@ async fn test_download_command_to_the_destination_dir(ctx: &mut CliTestContext)
3232
let (url_path, expected_content) = ctx.upload_dummy_file().await.unwrap();
3333
let destination_dir = ctx.workspace.join("destination_dir");
3434
tokio::fs::create_dir_all(&destination_dir).await.unwrap();
35-
Command::cargo_bin("cli")
35+
Command::cargo_bin("pf-cli")
3636
.unwrap()
3737
.args([
3838
"--server-addr",

cli/tests/cli/encrypt_and_decrypt_cli_test.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use assert_cmd::Command;
66
async fn test_encrypt_and_decrypt_to_the_destination_file(ctx: &mut CliTestContext) {
77
let (file, expected_content) = ctx.create_dummy_file().await.unwrap();
88
let key_nonce = generate_random_key_nonce();
9-
Command::cargo_bin("cli")
9+
Command::cargo_bin("pf-cli")
1010
.unwrap()
1111
.args([
1212
"--server-addr",
@@ -22,7 +22,7 @@ async fn test_encrypt_and_decrypt_to_the_destination_file(ctx: &mut CliTestConte
2222
.assert()
2323
.success();
2424
let destination_file_path = ctx.workspace.join("destination_file.txt");
25-
Command::cargo_bin("cli")
25+
Command::cargo_bin("pf-cli")
2626
.unwrap()
2727
.args([
2828
"--server-addr",
@@ -49,7 +49,7 @@ async fn test_encrypt_and_decrypt_to_the_destination_file(ctx: &mut CliTestConte
4949
async fn test_encrypt_and_decrypt_with_progress_bar(ctx: &mut CliTestContext) {
5050
let (file, expected_content) = ctx.create_dummy_file().await.unwrap();
5151
let key_nonce = generate_random_key_nonce();
52-
Command::cargo_bin("cli")
52+
Command::cargo_bin("pf-cli")
5353
.unwrap()
5454
.args([
5555
"--server-addr",
@@ -66,7 +66,7 @@ async fn test_encrypt_and_decrypt_with_progress_bar(ctx: &mut CliTestContext) {
6666
.assert()
6767
.success();
6868
let destination_file_path = ctx.workspace.join("destination_file.txt");
69-
Command::cargo_bin("cli")
69+
Command::cargo_bin("pf-cli")
7070
.unwrap()
7171
.args([
7272
"--server-addr",
@@ -94,7 +94,7 @@ async fn test_encrypt_and_decrypt_with_progress_bar(ctx: &mut CliTestContext) {
9494
async fn test_encrypt_file_and_decrypt_to_the_destination_dir(ctx: &mut CliTestContext) {
9595
let (file, expected_content) = ctx.create_dummy_file().await.unwrap();
9696
let key_nonce = generate_random_key_nonce();
97-
Command::cargo_bin("cli")
97+
Command::cargo_bin("pf-cli")
9898
.unwrap()
9999
.args([
100100
"--server-addr",
@@ -111,7 +111,7 @@ async fn test_encrypt_file_and_decrypt_to_the_destination_dir(ctx: &mut CliTestC
111111
.success();
112112
let destination_dir = ctx.workspace.join("destination_dir");
113113
tokio::fs::create_dir_all(&destination_dir).await.unwrap();
114-
Command::cargo_bin("cli")
114+
Command::cargo_bin("pf-cli")
115115
.unwrap()
116116
.args([
117117
"--server-addr",

cli/tests/cli/helper/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl CliTestContext {
4747
let port = find_free_port().await.unwrap();
4848
let server_addr = format!("http://127.0.0.1:{port}");
4949

50-
let child = tokio::process::Command::new("target/debug/api")
50+
let child = tokio::process::Command::new("target/debug/pf-api")
5151
.args(["--settings", "api/settings/base.toml"])
5252
.env("PF__SERVER__PORT", port.to_string())
5353
.env("PF__DB__PATH_DIR", db_path)
@@ -84,7 +84,7 @@ impl CliTestContext {
8484

8585
pub async fn upload_dummy_file(&self) -> anyhow::Result<(FileUrlPath, String)> {
8686
let (file, content) = self.create_dummy_file().await?;
87-
let output = tokio::process::Command::new("target/debug/cli")
87+
let output = tokio::process::Command::new("target/debug/pf-cli")
8888
.args([
8989
"--server-addr",
9090
&self.server_addr,
@@ -125,7 +125,7 @@ async fn find_free_port() -> anyhow::Result<u16> {
125125
}
126126

127127
async fn ping(root_dir: &Path, server_addr: &str) -> Result<ExitStatus, io::Error> {
128-
tokio::process::Command::new("target/debug/cli")
128+
tokio::process::Command::new("target/debug/pf-cli")
129129
.args(["--server-addr", server_addr, "ping"])
130130
.current_dir(root_dir)
131131
.stderr(Stdio::null())

cli/tests/cli/info_cli_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::helper::CliTestContext;
66
#[tokio::test]
77
async fn test_upload_and_info_command(ctx: &mut CliTestContext) {
88
let (url_path, _) = ctx.upload_dummy_file().await.unwrap();
9-
Command::cargo_bin("cli")
9+
Command::cargo_bin("pf-cli")
1010
.unwrap()
1111
.args([
1212
"--server-addr",

cli/tests/cli/ping_cli_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::helper::CliTestContext;
55
#[test_context::test_context(CliTestContext)]
66
#[tokio::test]
77
async fn test_ping_command(ctx: &mut CliTestContext) {
8-
Command::cargo_bin("cli")
8+
Command::cargo_bin("pf-cli")
99
.unwrap()
1010
.args(["--server-addr", &ctx.server_addr, "ping"])
1111
.assert()

cli/tests/cli/upload_and_download_cli_test.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::helper::{generate_random_key_nonce, CliTestContext};
77
#[tokio::test]
88
async fn test_upload_and_download_command_with_progress_bar(ctx: &mut CliTestContext) {
99
let (file, expected_content) = ctx.create_dummy_file().await.unwrap();
10-
let url_path = Command::cargo_bin("cli")
10+
let url_path = Command::cargo_bin("pf-cli")
1111
.unwrap()
1212
.args([
1313
"--server-addr",
@@ -25,7 +25,7 @@ async fn test_upload_and_download_command_with_progress_bar(ctx: &mut CliTestCon
2525
let url_path = std::str::from_utf8(&url_path).unwrap().trim();
2626
let destination_dir = ctx.workspace.join("destination_dir");
2727
tokio::fs::create_dir_all(&destination_dir).await.unwrap();
28-
Command::cargo_bin("cli")
28+
Command::cargo_bin("pf-cli")
2929
.unwrap()
3030
.args([
3131
"--server-addr",
@@ -51,7 +51,7 @@ async fn test_upload_and_download_command_with_progress_bar(ctx: &mut CliTestCon
5151
#[tokio::test]
5252
async fn test_upload_and_download_command_to_the_destination_dir(ctx: &mut CliTestContext) {
5353
let (file, expected_content) = ctx.create_dummy_file().await.unwrap();
54-
let url_path = Command::cargo_bin("cli")
54+
let url_path = Command::cargo_bin("pf-cli")
5555
.unwrap()
5656
.args([
5757
"--server-addr",
@@ -68,7 +68,7 @@ async fn test_upload_and_download_command_to_the_destination_dir(ctx: &mut CliTe
6868
let url_path = std::str::from_utf8(&url_path).unwrap().trim();
6969
let destination_dir = ctx.workspace.join("destination_dir");
7070
tokio::fs::create_dir_all(&destination_dir).await.unwrap();
71-
Command::cargo_bin("cli")
71+
Command::cargo_bin("pf-cli")
7272
.unwrap()
7373
.args([
7474
"--server-addr",
@@ -96,7 +96,7 @@ async fn test_upload_encrypt_and_download_decrypt_command_to_the_destination_dir
9696
) {
9797
let key_nonce = generate_random_key_nonce();
9898
let (file, expected_content) = ctx.create_dummy_file().await.unwrap();
99-
let url_path = Command::cargo_bin("cli")
99+
let url_path = Command::cargo_bin("pf-cli")
100100
.unwrap()
101101
.args([
102102
"--server-addr",
@@ -118,7 +118,7 @@ async fn test_upload_encrypt_and_download_decrypt_command_to_the_destination_dir
118118

119119
let destination_dir = ctx.workspace.join("destination_dir");
120120
tokio::fs::create_dir_all(&destination_dir).await.unwrap();
121-
Command::cargo_bin("cli")
121+
Command::cargo_bin("pf-cli")
122122
.unwrap()
123123
.args([
124124
"--server-addr",
@@ -150,7 +150,7 @@ async fn test_upload_encrypt_and_download_decrypt_command_to_the_destination_dir
150150
async fn test_upload_and_download_command_to_the_destination_file(ctx: &mut CliTestContext) {
151151
let (url_path, expected_content) = ctx.upload_dummy_file().await.unwrap();
152152
let destination_file_path = ctx.workspace.join("destination_file.text");
153-
Command::cargo_bin("cli")
153+
Command::cargo_bin("pf-cli")
154154
.unwrap()
155155
.args([
156156
"--server-addr",
@@ -177,7 +177,7 @@ async fn test_upload_encrypt_and_download_decrypt_command_to_the_destination_fil
177177
) {
178178
let key_nonce = generate_random_key_nonce();
179179
let (file, expected_content) = ctx.create_dummy_file().await.unwrap();
180-
let url_path = Command::cargo_bin("cli")
180+
let url_path = Command::cargo_bin("pf-cli")
181181
.unwrap()
182182
.args([
183183
"--server-addr",
@@ -197,7 +197,7 @@ async fn test_upload_encrypt_and_download_decrypt_command_to_the_destination_fil
197197
assert!(!tokio::fs::try_exists(encrypt_file).await.unwrap());
198198
let url_path = std::str::from_utf8(&url_path).unwrap().trim();
199199
let destination_file_path = ctx.workspace.join("destination_file.txt");
200-
Command::cargo_bin("cli")
200+
Command::cargo_bin("pf-cli")
201201
.unwrap()
202202
.args([
203203
"--server-addr",

cli/tests/cli/upload_cli_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::helper::CliTestContext;
66
#[tokio::test]
77
async fn test_upload_command(ctx: &mut CliTestContext) {
88
let (file, _) = ctx.create_dummy_file().await.unwrap();
9-
Command::cargo_bin("cli")
9+
Command::cargo_bin("pf-cli")
1010
.unwrap()
1111
.args([
1212
"--server-addr",

scripts/rm-test-dump.sh renamed to scripts/clean-test-dump.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
44
rm -rf test-dump
55
rm -rf api/test-dump
6-
rm -rf tmp/
6+
rm -rf tmp/
7+
rm -rf target/

0 commit comments

Comments
 (0)