Files
2026-11-27 06:03:56 +00:00

13 lines
782 B
Plaintext

use dever_runtime::{task, Bytes};
let fixtures = std::path::Path::new(@tls_fixtures@);
let ca = Bytes::from(std::fs::read(fixtures.join("root.pem")).unwrap());
let cert = Bytes::from(std::fs::read(fixtures.join("server.pem")).unwrap());
let key = Bytes::from(std::fs::read(fixtures.join("server-key.pem")).unwrap());
assert_eq!(format!("{:?}", @defaultTls@()), "ClientTls");
assert_eq!(format!("{:?}", @clientTls@(&ca).unwrap()), "ClientTls");
assert_eq!(format!("{:?}", @serverTls@(&cert, &key).unwrap()), "ServerTls");
assert!(@clientTls@(&Bytes::new()).is_err());
assert!(@serverTls@(&cert, &Bytes::new()).is_err());
let configured = task::run(true, 8, async |scope| @scheduledTls@(scope, ca.clone()).await).unwrap().unwrap();
assert_eq!(format!("{configured:?}"), "ClientTls");