MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / test_base_event_builder

Function test_base_event_builder

crates/openshell-ocsf/src/builders/base.rs:78–94  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

76
77 #[test]
78 fn test_base_event_builder() {
79 let ctx = test_sandbox_context();
80 let event = BaseEventBuilder::new(&ctx)
81 .severity(SeverityId::Informational)
82 .status(StatusId::Success)
83 .activity_name("Network Namespace Created")
84 .message("Network namespace created")
85 .unmapped("namespace", serde_json::json!("openshell-sandbox-abc123"))
86 .unmapped("host_ip", serde_json::json!("10.42.0.1"))
87 .build();
88
89 let json = event.to_json().unwrap();
90 assert_eq!(json["class_uid"], 0);
91 assert_eq!(json["activity_name"], "Network Namespace Created");
92 assert_eq!(json["message"], "Network namespace created");
93 assert_eq!(json["unmapped"]["namespace"], "openshell-sandbox-abc123");
94 }
95}

Callers

nothing calls this directly

Calls 6

test_sandbox_contextFunction · 0.85
messageMethod · 0.80
to_jsonMethod · 0.80
buildMethod · 0.45
unmappedMethod · 0.45
activity_nameMethod · 0.45

Tested by

no test coverage detected