v0.2.6-pre.011
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-app-wallet-desk/unit_tests/wallet_security.rs
|
||||
// version: 1
|
||||
// version: 2
|
||||
|
||||
#[test]
|
||||
fn password_rotation_request_is_deserializable_without_copy_contracts() {
|
||||
@@ -11,3 +11,18 @@ fn password_rotation_request_is_deserializable_without_copy_contracts() {
|
||||
}
|
||||
assert_deserializable(std::marker::PhantomData::<crate::WalletPasswordRotationRequestDto>);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn view_security_status_is_serializable_and_contains_no_password_field() {
|
||||
fn assert_serializable<T>(_marker: std::marker::PhantomData<T>)
|
||||
where
|
||||
T: serde::Serialize,
|
||||
{
|
||||
return;
|
||||
}
|
||||
assert_serializable(std::marker::PhantomData::<crate::WalletViewSecurityStatusDto>);
|
||||
let source = include_str!("../src/wallet_security.rs");
|
||||
let status = source.split("pub(crate) struct WalletViewSecurityStatusDto").nth(1).unwrap_or_default().split("}\n").next().unwrap_or_default();
|
||||
let fields = status.lines().filter(|line| return line.trim_start().starts_with("pub(crate) ")).collect::<std::vec::Vec<_>>().join("\n");
|
||||
assert!(!fields.contains("password"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user