diff --git a/openadr-client/tests/event.rs b/openadr-client/tests/event.rs index 5ab355a..157021d 100644 --- a/openadr-client/tests/event.rs +++ b/openadr-client/tests/event.rs @@ -1,9 +1,10 @@ use axum::http::StatusCode; use openadr_client::{Error, Filter, PaginationOptions}; use openadr_wire::{ - event::{EventContent, Priority}, + event::{EventContent, EventInterval, EventType, EventValuesMap, Priority}, program::{ProgramContent, ProgramId}, target::{TargetEntry, TargetLabel, TargetMap}, + values_map::Value, }; use sqlx::PgPool; @@ -17,7 +18,14 @@ fn default_content(program_id: &ProgramId) -> EventContent { priority: Priority::MAX, report_descriptors: None, interval_period: None, - intervals: vec![], + intervals: vec![EventInterval { + id: 0, + interval_period: None, + payloads: vec![EventValuesMap { + value_type: EventType::Price, + values: vec![Value::Number(123.4)], + }], + }], payload_descriptors: None, targets: None, } diff --git a/openadr-vtn/src/api/event.rs b/openadr-vtn/src/api/event.rs index ec4ba69..f5fa3f4 100644 --- a/openadr-vtn/src/api/event.rs +++ b/openadr-vtn/src/api/event.rs @@ -129,9 +129,10 @@ mod test { }; use http_body_util::BodyExt; use openadr_wire::{ - event::{EventPayloadDescriptor, EventType, Priority}, + event::{EventInterval, EventPayloadDescriptor, EventType, EventValuesMap, Priority}, problem::Problem, target::{TargetEntry, TargetMap}, + values_map::Value, }; use reqwest::Method; use sqlx::PgPool; @@ -145,13 +146,20 @@ mod test { priority: Priority::MAX, report_descriptors: None, interval_period: None, - intervals: vec![], + intervals: vec![EventInterval { + id: 0, + interval_period: None, + payloads: vec![EventValuesMap { + value_type: EventType::Price, + values: vec![Value::Number(123.4)], + }], + }], payload_descriptors: None, targets: None, } } - fn event_request(method: http::Method, event: Event, token: &str) -> Request
{ + fn event_request(method: Method, event: Event, token: &str) -> Request { Request::builder() .method(method) .uri(format!("/events/{}", event.id)) diff --git a/openadr-wire/src/event.rs b/openadr-wire/src/event.rs index f7c25f6..fbd6268 100644 --- a/openadr-wire/src/event.rs +++ b/openadr-wire/src/event.rs @@ -54,6 +54,7 @@ pub struct EventContent { /// Defines default start and durations of intervals. pub interval_period: Option