-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathintegration_tests.rs
More file actions
39 lines (27 loc) · 925 Bytes
/
integration_tests.rs
File metadata and controls
39 lines (27 loc) · 925 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use cryptor;
#[test]
fn test_encrypt_string() {
let to_encrypt = "hello_world_from_rust";
let str_encoded_b64 = "aGVsbG9fd29ybGRfZnJvbV9ydXN0";
let encrypted_result = cryptor::encrypt(&to_encrypt);
assert_eq!(str_encoded_b64, encrypted_result);
}
#[test]
fn test_decrypt_string() {
let str_encoded_b64 = "aGVsbG9fd29ybGRfZnJvbV9ydXN0";
let str_decoded_b64 = "hello_world_from_rust";
let decrypted_result = cryptor::decrypt(&str_encoded_b64);
assert_eq!(str_decoded_b64, decrypted_result);
}
#[test]
fn test_decrypt_empty_string() {
let empty_str = "";
let decrypted_result: String = cryptor::decrypt(&empty_str);
assert_eq!(empty_str, decrypted_result)
}
#[test]
fn test_decrypt_invalid_base64_string() {
let invalid_base64_str = "dfoiuerw892";
let decrypted_result: String = cryptor::decrypt(&invalid_base64_str);
assert_eq!("", decrypted_result)
}