const EMBEDDED_POLICY_JSON: &str = include_str!(concat!(env!("OUT_DIR"), "/policy.json"));
pub fn embedded_policy_json() -> &'static str {
EMBEDDED_POLICY_JSON
}
const EMBEDDED_NETWORK_POLICY_JSON: &str =
include_str!(concat!(env!("OUT_DIR"), "/network-policy.json"));
pub fn embedded_network_policy_json() -> &'static str {
EMBEDDED_NETWORK_POLICY_JSON
}
const EMBEDDED_PROFILE_SCHEMA: &str =
include_str!(concat!(env!("OUT_DIR"), "/nono-profile.schema.json"));
pub fn embedded_profile_schema() -> &'static str {
EMBEDDED_PROFILE_SCHEMA
}
const EMBEDDED_PROFILE_GUIDE: &str =
include_str!(concat!(env!("OUT_DIR"), "/profile-authoring-guide.md"));
pub fn embedded_profile_guide() -> &'static str {
EMBEDDED_PROFILE_GUIDE
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_load_embedded_policy() {
let json = embedded_policy_json();
assert!(!json.is_empty());
let policy: serde_json::Value =
serde_json::from_str(json).expect("Failed to parse embedded policy.json");
assert!(policy.get("groups").is_some());
}
#[test]
fn test_load_embedded_network_policy() {
let json = embedded_network_policy_json();
assert!(!json.is_empty());
let policy: serde_json::Value =
serde_json::from_str(json).expect("Failed to parse network-policy.json");
assert!(policy.get("groups").is_some());
assert!(policy.get("profiles").is_some());
}
}