Skip to content

Commit

Permalink
Added testing for get_time
Browse files Browse the repository at this point in the history
Signed-off-by: Maurice Blattmann <[email protected]>
  • Loading branch information
maurice-blattmann committed Oct 17, 2024
1 parent f4a5d4e commit dacee50
Showing 1 changed file with 41 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,47 @@ mod test_quote {
}
}

#[test]
fn time() {
let mut context = create_ctx_with_session();
// No qualifying data
let qualifying_data = vec![0xff; 16];

let key_handle = context
.create_primary(Hierarchy::Owner, signing_key_pub(), None, None, None, None)
.unwrap()
.key_handle;
let (attest, _signature) = context
.execute_with_sessions(
(
Some(AuthSession::Password),
Some(AuthSession::Password),
None,
),
|ctx| {
ctx.get_time(
key_handle,
Data::try_from(qualifying_data).unwrap(),
SignatureScheme::Null,
)
},
)
.expect("Failed to get time");

assert_eq!(
AttestationType::Time,
attest.attestation_type(),
"Attestation type of the returned value is not indicating Time"
);

match attest.attested() {
AttestInfo::Time { info: _ } => {}
_ => {
panic!("Attested did not contain the expected variant.")
}
}
}

#[test]
fn certify() {
let mut context = create_ctx_with_session();
Expand Down

0 comments on commit dacee50

Please sign in to comment.