store: Fix test_calendar

This commit is contained in:
Lennart
2025-01-01 14:18:37 +01:00
parent 00d284b0fb
commit 11fa0f24c7
5 changed files with 34 additions and 7 deletions

View File

@@ -18,7 +18,7 @@ impl XmlSerialize for Resourcetype {
) -> std::io::Result<()> {
let tag_str = tag.map(String::from_utf8_lossy);
if let Some(tag) = &tag_str {
writer.write_event(Event::Start(BytesStart::new(tag.to_owned())))?;
writer.write_event(Event::Start(BytesStart::new(tag.clone())))?;
}
for &ty in self.0 {
@@ -26,7 +26,7 @@ impl XmlSerialize for Resourcetype {
}
if let Some(tag) = &tag_str {
writer.write_event(Event::End(BytesEnd::new(tag.to_owned())))?;
writer.write_event(Event::End(BytesEnd::new(tag.clone())))?;
}
Ok(())
}

View File

@@ -29,3 +29,5 @@ rustical_xml.workspace = true
[dev-dependencies]
rstest = { workspace = true }
rstest_reuse = { workspace = true }
rustical_store_sqlite.workspace = true
tokio.workspace = true

View File

@@ -1,7 +1,7 @@
use rstest::rstest;
use rstest_reuse::{self, apply, template};
use rustical_store::sqlite_store::create_test_store;
use rustical_store::{model::CalendarObject, CalendarStore};
use rustical_store::{CalendarObject, CalendarStore};
use rustical_store_sqlite::create_test_store;
const TIMEZONE: &str = include_str!("examples/timezone.ics");
const EVENT: &str = include_str!("examples/event.ics");
@@ -24,9 +24,9 @@ async fn test_init<CS: CalendarStore>(_store: CS) {
#[apply(cal_store)]
#[tokio::test]
async fn test_create_event<CS: CalendarStore>(mut store: CS) {
async fn test_create_event<CS: CalendarStore>(store: CS) {
store
.insert_calendar(rustical_store::model::Calendar {
.insert_calendar(rustical_store::Calendar {
id: "test".to_owned(),
displayname: Some("Test Calendar".to_owned()),
principal: "testuser".to_owned(),
@@ -38,7 +38,7 @@ async fn test_create_event<CS: CalendarStore>(mut store: CS) {
let object = CalendarObject::from_ics("asd".to_owned(), EVENT.to_owned()).unwrap();
store
.put_object("testuser".to_owned(), "test".to_owned(), object)
.put_object("testuser".to_owned(), "test".to_owned(), object, true)
.await
.unwrap();