From ae5abf2480ca21ef9bc65cabcf8987d6a3d3b0cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=C4=9Fuzhan=20Emre=20=C3=96zdo=C4=9Fan?= Date: Wed, 3 Apr 2024 16:44:49 +0300 Subject: [PATCH] fix tests --- schema/src/tests.rs | 95 +++++++++++++++++---------------------------- 1 file changed, 36 insertions(+), 59 deletions(-) diff --git a/schema/src/tests.rs b/schema/src/tests.rs index 0c827db..e522789 100644 --- a/schema/src/tests.rs +++ b/schema/src/tests.rs @@ -20,6 +20,7 @@ impl transport::Transport for FakeTransport { } #[test] +#[cfg(feature = "devicemgmt")] fn basic_deserialization() { let response = r#" @@ -66,6 +67,7 @@ fn basic_deserialization() { assert_eq!(de.utc_date_time.as_ref().unwrap().time.second, 9); } +#[cfg(feature = "devicemgmt")] #[test] fn basic_serialization() { let expected = r#" @@ -327,6 +329,7 @@ fn duration_deserialization() { } #[tokio::test] +#[cfg(feature = "devicemgmt")] async fn operation_get_system_date_and_time() { let req: devicemgmt::GetSystemDateAndTime = Default::default(); @@ -369,6 +372,7 @@ async fn operation_get_system_date_and_time() { } #[tokio::test] +#[cfg(feature = "devicemgmt")] async fn operation_get_device_information() { let req: devicemgmt::GetDeviceInformation = Default::default(); @@ -622,32 +626,20 @@ fn extension_inside_extension() { } #[tokio::test] +#[cfg(feature = "event")] async fn operation_pull_messages() { let req: event::PullMessages = Default::default(); let transport = FakeTransport { response: r#" - - - - - http://www.onvif.org/ver10/events/wsdl/PullPointSubscription/PullMessagesResponse - - - http://192.168.88.108/onvif/Subscription?Idx=5 - - - - + 2023-09-28T16:01:15Z @@ -683,13 +675,16 @@ async fn operation_pull_messages() { - - "# .into(), }; - let resp = event::pull_messages(&transport, &req).await.unwrap(); + let response = event::pull_messages(&transport, &req).await; + + let resp = match response { + Ok(resp) => resp, + Err(err) => panic!("Error: {:?}", err), + }; assert_eq!( resp.notification_message[0].message.msg.source.simple_item[0].name, @@ -710,46 +705,28 @@ async fn operation_pull_messages() { } #[tokio::test] +#[cfg(feature = "event")] async fn operation_create_pullpoint_subscription() { let req: event::CreatePullPointSubscription = Default::default(); let transport = FakeTransport { response: r#" - - - - - http://www.onvif.org/ver10/events/wsdl/EventPortType/CreatePullPointSubscriptionResponse - - - http://192.168.88.108/onvif/event_service - - - - - - - http://192.168.88.108/onvif/Subscription?Idx=5 - - - - 2023-09-28T16:01:15Z - - - 2023-09-28T16:11:15Z - - - - + + + + http://192.168.88.108/onvif/Subscription?Idx=5 + + + + 2023-09-28T16:01:15Z + + + 2023-09-28T16:11:15Z + + "# .into(), };