()
| 121 | |
| 122 | #[test] |
| 123 | fn test_http_activity_builder() { |
| 124 | let ctx = test_sandbox_context(); |
| 125 | let event = HttpActivityBuilder::new(&ctx) |
| 126 | .activity(ActivityId::Reset) // Get = 3 |
| 127 | .action(ActionId::Allowed) |
| 128 | .disposition(DispositionId::Allowed) |
| 129 | .severity(SeverityId::Informational) |
| 130 | .http_request(HttpRequest::new( |
| 131 | "GET", |
| 132 | Url::new("https", "api.example.com", "/v1/data", 443), |
| 133 | )) |
| 134 | .actor_process(Process::new("curl", 88)) |
| 135 | .firewall_rule("default-egress", "mechanistic") |
| 136 | .build(); |
| 137 | |
| 138 | let json = event.to_json().unwrap(); |
| 139 | assert_eq!(json["class_uid"], 4002); |
| 140 | assert_eq!(json["activity_name"], "Get"); |
| 141 | assert_eq!(json["http_request"]["http_method"], "GET"); |
| 142 | assert_eq!(json["actor"]["process"]["name"], "curl"); |
| 143 | } |
| 144 | |
| 145 | #[test] |
| 146 | fn test_http_activity_builder_with_status_detail() { |
nothing calls this directly
no test coverage detected