Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a test checking ListKeys provider target #313

Merged
merged 1 commit into from
Jan 13, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
ionut-arm marked this conversation as resolved.
Show resolved Hide resolved
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);
}