Move test_id_certificate to test and use cfg(test). Without the latter cargo publish won't work since we exclude test resources for space.

This commit is contained in:
Tim Bruijnzeels
2020-10-12 08:24:01 +02:00
parent 7e57922f73
commit 187da0db82
6 changed files with 12 additions and 11 deletions
-1
View File
@@ -732,7 +732,6 @@ impl From<&PublicKey> for IdExtensions {
#[cfg(test)]
pub mod tests {
use crate::commons::crypto::test_id_certificate;
use crate::test::*;
use super::*;
-7
View File
@@ -11,10 +11,3 @@ mod signing;
pub use self::signing::*;
pub type CryptoResult<T> = std::result::Result<T, self::error::Error>;
pub fn test_id_certificate() -> IdCert {
use bytes::Bytes;
let data = include_bytes!("../../../test-resources/oob/id_publisher_ta.cer");
IdCert::decode(Bytes::from_static(data)).unwrap()
}
+1 -1
View File
@@ -767,10 +767,10 @@ mod tests {
use std::str::FromStr;
use crate::commons::api::RoaDefinition;
use crate::commons::crypto::test_id_certificate;
use super::*;
use crate::test::definition;
use crate::test::test_id_certificate;
fn verify(expected_json: &str, e: Error) {
let actual = e.to_error_response();
+1 -1
View File
@@ -901,9 +901,9 @@ mod tests {
use std::str;
use std::str::from_utf8_unchecked;
use crate::commons::crypto::test_id_certificate;
use crate::commons::crypto::IdCert;
use crate::commons::crypto::ProtocolCms;
use crate::test::test_id_certificate;
use super::*;
+1 -1
View File
@@ -800,8 +800,8 @@ impl From<uri::Error> for Error {
mod tests {
use rpki::x509::Time;
use crate::commons::crypto::test_id_certificate;
use crate::test;
use crate::test::test_id_certificate;
use super::*;
+9
View File
@@ -539,3 +539,12 @@ pub fn definition(s: &str) -> RoaDefinition {
pub fn typed_prefix(s: &str) -> TypedPrefix {
TypedPrefix::from_str(s).unwrap()
}
#[cfg(test)]
use crate::commons::crypto::IdCert;
#[cfg(test)]
pub fn test_id_certificate() -> IdCert {
let data = include_bytes!("../test-resources/oob/id_publisher_ta.cer");
IdCert::decode(Bytes::from_static(data)).unwrap()
}