Skip to content

Commit 128878e

Browse files
committed
Add test for encryption via connection string
1 parent e673fb5 commit 128878e

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

libsql/tests/encryption.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,17 @@ async fn test_encryption() {
4545
assert_eq!(text, "the only winning move is not to play");
4646
}
4747

48+
// let's test encryption with connection string
49+
{
50+
let conn_str = format!("file:{}?key=s3cR3t", tempdir.join("encrypted.db").display());
51+
let db = Builder::new_local(&conn_str).build().await.unwrap();
52+
let conn = db.connect().unwrap();
53+
let mut results = conn.query("SELECT * FROM messages", ()).await.unwrap();
54+
let row = results.next().await.unwrap().unwrap();
55+
let text: String = row.get(0).unwrap();
56+
assert_eq!(text, "the only winning move is not to play");
57+
}
58+
4859
{
4960
let _ = std::fs::remove_file(&encrypted_path);
5061
let _ = std::fs::remove_file(&base_path);

0 commit comments

Comments
 (0)