Skip to content

Commit

Permalink
remove wrong test cases
Browse files Browse the repository at this point in the history
we had two test cases that only worked because we didn't do sufficient
validation. this commit removes them, because they don't actually make a
whole lot of sense.
  • Loading branch information
keks committed Sep 19, 2024
1 parent a53a332 commit 87efd10
Showing 1 changed file with 1 addition and 64 deletions.
65 changes: 1 addition & 64 deletions openmls/src/group/tests_and_kats/tests/proposal_validation.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
//! This module tests the validation of proposals as defined in
//! https://book.openmls.tech/message_validation.html#semantic-validation-of-proposals-covered-by-a-commit
use crate::{
storage::OpenMlsProvider,
test_utils::frankenstein::*,
treesync::{errors::LeafNodeValidationError, LeafNodeParameters},
};
use crate::{storage::OpenMlsProvider, test_utils::frankenstein::*, treesync::LeafNodeParameters};
use openmls_traits::{
prelude::{openmls_types::*, *},
signatures::Signer,
Expand Down Expand Up @@ -1002,10 +998,6 @@ enum KeyPackageTestVersion {
WrongCiphersuite,
// Wrong version in the KeyPackage
WrongVersion,
// Unsupported ciphersuite in the KeyPackage's capabilities
UnsupportedVersion,
// Unsupported ciphersuite in the KeyPackage's capabilities
UnsupportedCiphersuite,
// Positive case
ValidTestCase,
}
Expand Down Expand Up @@ -1046,8 +1038,6 @@ fn test_valsem105() {
for key_package_version in [
KeyPackageTestVersion::WrongCiphersuite,
KeyPackageTestVersion::WrongVersion,
//KeyPackageTestVersion::UnsupportedVersion,
// KeyPackageTestVersion::UnsupportedCiphersuite,
KeyPackageTestVersion::ValidTestCase,
] {
println!("running test {key_package_version:?}");
Expand Down Expand Up @@ -1083,13 +1073,6 @@ fn test_valsem105() {
KeyPackageTestVersion::WrongVersion => {
franken_key_package.protocol_version = 999;
}
KeyPackageTestVersion::UnsupportedVersion => {
franken_key_package.leaf_node.capabilities.versions = vec![999];
}
KeyPackageTestVersion::UnsupportedCiphersuite => {
franken_key_package.leaf_node.capabilities.ciphersuites =
vec![Ciphersuite::MLS_256_DHKEMX448_CHACHA20POLY1305_SHA512_Ed448.into()];
}
KeyPackageTestVersion::ValidTestCase => (),
};

Expand Down Expand Up @@ -1120,13 +1103,6 @@ fn test_valsem105() {
KeyPackageTestVersion::WrongVersion => {
franken_key_package.protocol_version = 999;
}
KeyPackageTestVersion::UnsupportedVersion => {
franken_key_package.leaf_node.capabilities.versions = vec![999];
}
KeyPackageTestVersion::UnsupportedCiphersuite => {
franken_key_package.leaf_node.capabilities.ciphersuites =
vec![Ciphersuite::MLS_256_DHKEMX448_CHACHA20POLY1305_SHA512_Ed448.into()];
}
KeyPackageTestVersion::ValidTestCase => (),
};

Expand Down Expand Up @@ -1322,45 +1298,6 @@ fn test_valsem105() {
)
);
}
KeyPackageTestVersion::UnsupportedVersion => {
assert!(
matches!(
err,
ProcessMessageError::ValidationError(
ValidationError::KeyPackageVerifyError(
KeyPackageVerifyError::InvalidProtocolVersion,
),
)
) || matches!(
err,
ProcessMessageError::InvalidCommit(
StageCommitError::ProposalValidationError(
ProposalValidationError::LeafNodeValidation(
LeafNodeValidationError::CiphersuiteNotInCapabilities
),
),
)
),
"unexpected error: {:?}",
err
);
}
KeyPackageTestVersion::UnsupportedCiphersuite => {
assert!(
matches!(
err,
ProcessMessageError::InvalidCommit(
StageCommitError::ProposalValidationError(
ProposalValidationError::LeafNodeValidation(
LeafNodeValidationError::CiphersuiteNotInCapabilities
),
),
)
),
"unexpected error: {:?}",
err
);
}
};

let original_update_plaintext =
Expand Down

0 comments on commit 87efd10

Please sign in to comment.