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

23
Cargo.lock generated
View File

@@ -519,6 +519,8 @@ dependencies = [
"http 1.2.0",
"http-body",
"http-body-util",
"hyper",
"hyper-util",
"itoa",
"matchit",
"memchr",
@@ -527,10 +529,15 @@ dependencies = [
"pin-project-lite",
"rustversion",
"serde",
"serde_json",
"serde_path_to_error",
"serde_urlencoded",
"sync_wrapper",
"tokio",
"tower 0.5.2",
"tower-layer",
"tower-service",
"tracing",
]
[[package]]
@@ -551,6 +558,7 @@ dependencies = [
"sync_wrapper",
"tower-layer",
"tower-service",
"tracing",
]
[[package]]
@@ -2589,6 +2597,7 @@ dependencies = [
"anyhow",
"argon2",
"async-trait",
"axum",
"clap",
"opentelemetry",
"opentelemetry-otlp",
@@ -2722,10 +2731,12 @@ dependencies = [
"regex",
"rstest",
"rstest_reuse",
"rustical_store_sqlite",
"rustical_xml",
"serde",
"sha2",
"thiserror 2.0.9",
"tokio",
"tracing",
]
@@ -2828,6 +2839,16 @@ dependencies = [
"serde",
]
[[package]]
name = "serde_path_to_error"
version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af99884400da37c88f5e9146b7f1fd0fbcae8f6eec4e9da38b67d05486f814a6"
dependencies = [
"itoa",
"serde",
]
[[package]]
name = "serde_spanned"
version = "0.6.8"
@@ -3529,8 +3550,10 @@ dependencies = [
"futures-util",
"pin-project-lite",
"sync_wrapper",
"tokio",
"tower-layer",
"tower-service",
"tracing",
]
[[package]]

View File

@@ -97,6 +97,7 @@ quote = "1.0"
proc-macro2 = "1.0"
heck = "0.5"
darling = "0.20"
axum = { version = "0.7", features = ["http2"] }
[dependencies]
rustical_store = { workspace = true }
@@ -132,3 +133,4 @@ rpassword.workspace = true
argon2.workspace = true
pbkdf2.workspace = true
password-hash.workspace = true
axum.workspace = true

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();