Skip to content

Commit

Permalink
Merge pull request #313 from hug-dev/check-list-keys-providers
Browse files Browse the repository at this point in the history
Add a test checking ListKeys provider target
  • Loading branch information
hug-dev authored Jan 13, 2021
2 parents c67b25a + 3ecc50a commit c22fe91
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion e2e_tests/tests/all_providers/normal.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
// Copyright 2019 Contributors to the Parsec project.
// SPDX-License-Identifier: Apache-2.0
use e2e_tests::RawRequestClient;
use e2e_tests::TestClient;
use parsec_client::core::interface::operations::list_providers::Uuid;
use parsec_client::core::interface::requests::{AuthType, Opcode, ProviderID, Result};
use parsec_client::core::interface::requests::request::RawHeader;
use parsec_client::core::interface::requests::{
AuthType, Opcode, ProviderID, ResponseStatus, Result,
};
use std::collections::HashSet;

#[test]
Expand Down Expand Up @@ -147,3 +151,19 @@ fn list_keys() {
assert!(key_names.contains(&(key2.clone(), ProviderID::Pkcs11)));
assert!(key_names.contains(&(key3.clone(), ProviderID::Tpm)));
}

#[test]
// See #310
fn invalid_provider_list_keys() {
let mut client = RawRequestClient {};
let mut req_hdr = RawHeader::new();

// Always targeting the Mbed Crypto provider
req_hdr.provider = 0x1;
req_hdr.opcode = Opcode::ListKeys as u32;

let resp = client
.send_raw_request(req_hdr, Vec::new())
.expect("Failed to read Response");
assert_eq!(resp.header.status, ResponseStatus::PsaErrorNotSupported);
}

0 comments on commit c22fe91

Please sign in to comment.