Skip to content

Commit 47515f6

Browse files
committed
Added verification test for zero-sized chunk case
1 parent 6d153e0 commit 47515f6

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

tests/query_tests.rs

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,36 @@ impl User {
3737
}
3838
}
3939

40+
#[derive(
41+
Identifiable, Encryptable, Decryptable, Searchable, Debug, PartialEq, Ord, PartialOrd, Eq,
42+
)]
43+
#[cipherstash(sort_key_prefix = "user")]
44+
pub struct PublicUser {
45+
#[partition_key]
46+
#[cipherstash(skip)]
47+
pub email: String,
48+
49+
#[cipherstash(skip)]
50+
pub name: String,
51+
52+
#[cipherstash(skip)]
53+
pub tag: String,
54+
55+
#[cipherstash(skip)]
56+
pub temp: bool,
57+
}
58+
59+
impl PublicUser {
60+
pub fn new(email: impl Into<String>, name: impl Into<String>, tag: impl Into<String>) -> Self {
61+
Self {
62+
name: name.into(),
63+
email: email.into(),
64+
tag: tag.into(),
65+
temp: false,
66+
}
67+
}
68+
}
69+
4070
async fn run_test<F: Future<Output = ()>>(mut f: impl FnMut(EncryptedTable) -> F) {
4171
let config = aws_config::from_env()
4272
.endpoint_url("http://localhost:8000")
@@ -193,3 +223,31 @@ async fn test_delete() {
193223
})
194224
.await;
195225
}
226+
227+
#[tokio::test]
228+
#[serial]
229+
async fn test_insert_retrieve_public() {
230+
231+
let config = aws_config::from_env()
232+
.endpoint_url("http://localhost:8000")
233+
.load()
234+
.await;
235+
236+
let client = aws_sdk_dynamodb::Client::new(&config);
237+
238+
let table_name = "test-public-users-pk";
239+
240+
common::create_table(&client, table_name).await;
241+
242+
let table = EncryptedTable::init(client, table_name)
243+
.await
244+
.expect("Failed to init table");
245+
246+
table
247+
.put(PublicUser::new("dan@coderdan.co", "Dan Draper", "blue"))
248+
.await
249+
.expect("Failed to insert Dan");
250+
251+
table
252+
.get::<PublicUser>("dan@coderdan.co").await.expect("Failed to get Dan");
253+
}

0 commit comments

Comments
 (0)