use crate::{CardDavPrincipalUri, addressbook::resource::AddressbookResource}; use rustical_dav::resource::Resource; use rustical_store::{Addressbook, auth::Principal}; use rustical_xml::XmlSerializeRoot; #[test] fn test_propfind() { let propfind = AddressbookResource::parse_propfind( r#""#, ) .unwrap(); insta::assert_debug_snapshot!(propfind); let principal = Principal { id: "user".to_string(), displayname: None, principal_type: rustical_store::auth::PrincipalType::Individual, password: None, memberships: vec!["group".to_string()], }; let addressbook = Addressbook { id: "yeet".to_string(), principal: "user".to_string(), displayname: None, description: None, deleted_at: None, synctoken: 0, push_topic: "asdasd".to_string(), }; let resource = AddressbookResource(addressbook.clone()); let response = resource .propfind( &format!( "/carddav/principal/{}/{}", addressbook.principal, addressbook.id ), &propfind.prop, propfind.include.as_ref(), &CardDavPrincipalUri("/carddav"), &principal, ) .unwrap(); insta::assert_debug_snapshot!(response); insta::assert_snapshot!(response.serialize_to_string().unwrap()); }