Skip to content

Commit

Permalink
Add test missing public key in dnskey in from_bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
konegoro committed Jan 12, 2024
1 parent c9af9b4 commit fab7eb9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/message/rdata/dnskey_rdata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ impl DnskeyRdata {

#[cfg(test)]
mod dnskey_rdata_test{
use std::vec;

use super::*;

#[test]
Expand Down Expand Up @@ -303,4 +305,14 @@ mod dnskey_rdata_test{
assert_eq!(dnskey_rdata.to_bytes(), bytes_test);
}

#[test]
fn missing_public_key_from_bytes() {
//Bytes array missing the public key
let bytes_test: Vec<u8> = vec![0, 1, 3, 5];

let result = DnskeyRdata::from_bytes(&bytes_test, &bytes_test);

assert_eq!(Err("Public key not assigned"), result);

}
}

0 comments on commit fab7eb9

Please sign in to comment.