Skip to content

Commit 87a54f6

Browse files
committed
test: simplify
1 parent c8de0af commit 87a54f6

27 files changed

+333
-686
lines changed

.rustfmt.toml

Lines changed: 0 additions & 54 deletions
This file was deleted.

Cargo.lock

Lines changed: 13 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ opt-level = 0
3939

4040
[workspace.dependencies]
4141
clap = { version = "4.5", default-features = false }
42-
cosmian_kms_cli = { git = "https://www.github.com/Cosmian/kms", branch = "develop" }
43-
cosmian_findex_cli = { git = "https://www.github.com/Cosmian/findex-server", branch = "develop" }
44-
cosmian_config_utils = { git = "https://www.github.com/Cosmian/http_client_server", branch = "develop" }
42+
cosmian_kms_cli = { git = "https://www.github.com/Cosmian/kms", branch = "docs/reviewed" }
43+
cosmian_findex_cli = { git = "https://www.github.com/Cosmian/findex-server", branch = "fix/return_index_id" }
44+
cosmian_config_utils = { git = "https://www.github.com/Cosmian/http_client_server", branch = "fix/config_utils_trait" }
4545
cosmian_http_client = { git = "https://www.github.com/Cosmian/http_client_server", branch = "develop" }
4646
cosmian_logger = { git = "https://www.github.com/Cosmian/http_client_server", branch = "develop" }
4747
hex = { version = "0.4", default-features = false }

crate/cli/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ actix-rt = "2.10"
4949
actix-server = { version = "2.5", default-features = false }
5050
assert_cmd = "2.0"
5151
const-oid = { version = "0.9", features = ["db"] }
52+
lazy_static = "1.4"
5253
openssl = { workspace = true }
5354
predicates = "3.1"
5455
regex = { version = "1.11", default-features = false }

crate/cli/src/actions/delete_datasets.rs

Lines changed: 0 additions & 34 deletions
This file was deleted.

crate/cli/src/actions/encrypt_and_index.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ use std::{
66

77
use clap::Parser;
88
use cosmian_findex_cli::{
9-
actions::findex::{FindexParameters, instantiate_findex},
9+
actions::findex::{instantiate_findex, FindexParameters},
1010
reexports::{
1111
cloudproof_findex::reexport::cosmian_findex::{
1212
Data, IndexedValue, IndexedValueToKeywordsMap, Keyword, Keywords,
1313
},
1414
cosmian_findex_client::FindexRestClient,
15-
cosmian_findex_structs::EncryptedEntries,
15+
cosmian_findex_structs::{EncryptedEntries, Uuids},
1616
},
1717
};
1818
use cosmian_kms_cli::{
@@ -271,7 +271,7 @@ impl EncryptAndIndexAction {
271271
&self,
272272
findex_rest_client: &FindexRestClient,
273273
kms_rest_client: &KmsClient,
274-
) -> CosmianResult<()> {
274+
) -> CosmianResult<Uuids> {
275275
let nonce = self
276276
.nonce
277277
.as_deref()
@@ -332,6 +332,6 @@ impl EncryptAndIndexAction {
332332
let uuids = encrypted_entries.get_uuids();
333333
println!("Data behind those UUIDS were encrypted and indexed: {uuids}");
334334

335-
Ok(())
335+
Ok(uuids)
336336
}
337337
}

crate/cli/src/actions/findex.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
use clap::Subcommand;
2-
use cosmian_findex_cli::{CoreFindexActions, reexports::cosmian_findex_client::FindexRestClient};
2+
use cosmian_findex_cli::{reexports::cosmian_findex_client::FindexRestClient, CoreFindexActions};
33
use cosmian_kms_cli::reexport::cosmian_kms_client::KmsClient;
44

5-
use super::{
6-
delete_datasets::DeleteDatasetAction, encrypt_and_index::EncryptAndIndexAction,
7-
search_and_decrypt::SearchAndDecryptAction,
8-
};
9-
use crate::error::{CosmianError, result::CosmianResult};
5+
use super::{encrypt_and_index::EncryptAndIndexAction, search_and_decrypt::SearchAndDecryptAction};
6+
use crate::error::{result::CosmianResult, CosmianError};
107

118
#[derive(Subcommand)]
129
pub enum FindexActions {
1310
EncryptAndIndex(EncryptAndIndexAction),
1411
SearchAndDecrypt(SearchAndDecryptAction),
15-
DeleteDataset(DeleteDatasetAction),
1612
#[clap(flatten)]
1713
Findex(CoreFindexActions),
1814
}
@@ -33,9 +29,14 @@ impl FindexActions {
3329
.run(findex_rest_client)
3430
.await
3531
.map_err(CosmianError::from),
36-
Self::EncryptAndIndex(action) => action.run(findex_rest_client, kms_rest_client).await,
37-
Self::SearchAndDecrypt(action) => action.run(findex_rest_client, kms_rest_client).await,
38-
Self::DeleteDataset(action) => action.run(findex_rest_client).await,
32+
Self::EncryptAndIndex(action) => {
33+
action.run(findex_rest_client, kms_rest_client).await?;
34+
Ok(())
35+
}
36+
Self::SearchAndDecrypt(action) => {
37+
action.run(findex_rest_client, kms_rest_client).await?;
38+
Ok(())
39+
}
3940
}
4041
}
4142
}

crate/cli/src/actions/markdown.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::{fmt::Write, fs::File, io::Write as io_Write, path::PathBuf};
22

3-
use clap::{Command, Parser, builder::StyledStr};
3+
use clap::{builder::StyledStr, Command, Parser};
44

55
use crate::error::result::CosmianResult;
66

crate/cli/src/actions/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
pub mod delete_datasets;
21
pub mod encrypt_and_index;
32
pub mod findex;
43
pub mod markdown;

crate/cli/src/actions/search_and_decrypt.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use clap::Parser;
22
use cosmian_findex_cli::{
3-
actions::findex::{FindexParameters, instantiate_findex},
3+
actions::findex::{instantiate_findex, FindexParameters},
44
reexports::{
55
cloudproof_findex::reexport::cosmian_findex::{Keyword, Keywords},
66
cosmian_findex_client::FindexRestClient,
@@ -73,7 +73,7 @@ impl SearchAndDecryptAction {
7373
&self,
7474
findex_rest_client: &FindexRestClient,
7575
kms_rest_client: &KmsClient,
76-
) -> CosmianResult<()> {
76+
) -> CosmianResult<Vec<String>> {
7777
let results = instantiate_findex(findex_rest_client, &self.findex_parameters.index_id)
7878
.await?
7979
.search(
@@ -154,6 +154,6 @@ impl SearchAndDecryptAction {
154154

155155
println!("Decrypted records: {results:?}");
156156

157-
Ok(())
157+
Ok(results)
158158
}
159159
}

0 commit comments

Comments
 (0)