diff --git a/proxmox-api-macro/tests/api2.rs b/proxmox-api-macro/tests/api2.rs index beaa5a0e..64e3c29d 100644 --- a/proxmox-api-macro/tests/api2.rs +++ b/proxmox-api-macro/tests/api2.rs @@ -32,6 +32,24 @@ pub async fn number(num: u32) -> Result { Ok(num) } +#[test] +fn number_schema_check() { + const TEST_METHOD: ::proxmox::api::ApiMethod = ::proxmox::api::ApiMethod::new( + &::proxmox::api::ApiHandler::Async(&api_function_number), + &::proxmox::api::schema::ObjectSchema::new( + "Return the number...", + &[( + "num", + false, + &::proxmox::api::schema::IntegerSchema::new("The version to upgrade to").schema(), + )], + ), + ) + .protected(false); + + assert_eq!(TEST_METHOD, API_METHOD_NUMBER); +} + #[api( input: { properties: { @@ -51,3 +69,28 @@ pub async fn more_async_params(param: Value) -> Result<(), Error> { let _ = param; Ok(()) } + +#[test] +fn more_async_params_schema_check() { + const TEST_METHOD: ::proxmox::api::ApiMethod = ::proxmox::api::ApiMethod::new( + &::proxmox::api::ApiHandler::Async(&api_function_more_async_params), + &::proxmox::api::schema::ObjectSchema::new( + "Return the number...", + &[ + ( + "bar", + false, + &::proxmox::api::schema::StringSchema::new("The great Bar").schema(), + ), + ( + "foo", + false, + &::proxmox::api::schema::StringSchema::new("The great Foo").schema(), + ), + ], + ), + ) + .protected(false); + + assert_eq!(TEST_METHOD, API_METHOD_MORE_ASYNC_PARAMS); +}