diff --git a/Cargo.toml b/Cargo.toml index a045c46..abcf2e0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,9 +32,6 @@ opentelemetry = [ "dep:tracing-opentelemetry", ] -[profile.dev] -debug = 0 - [lib] doc = true name = "rustical" diff --git a/crates/store_sqlite/src/lib.rs b/crates/store_sqlite/src/lib.rs index 50b9428..92c0b57 100644 --- a/crates/store_sqlite/src/lib.rs +++ b/crates/store_sqlite/src/lib.rs @@ -37,11 +37,11 @@ impl SqliteStore { } pub async fn create_db_pool(db_url: &str, migrate: bool) -> Result, sqlx::Error> { + let options: SqliteConnectOptions = db_url.parse()?; + let db = SqlitePool::connect_with( - SqliteConnectOptions::new() + options .journal_mode(sqlx::sqlite::SqliteJournalMode::Wal) - .synchronous(sqlx::sqlite::SqliteSynchronous::Normal) - .filename(db_url) .create_if_missing(true), ) .await?; diff --git a/crates/store_sqlite/src/tests/mod.rs b/crates/store_sqlite/src/tests/mod.rs index 2f33ead..69e032b 100644 --- a/crates/store_sqlite/src/tests/mod.rs +++ b/crates/store_sqlite/src/tests/mod.rs @@ -1,6 +1,6 @@ use crate::{ SqliteStore, addressbook_store::SqliteAddressbookStore, calendar_store::SqliteCalendarStore, - principal_store::SqlitePrincipalStore, + create_db_pool, principal_store::SqlitePrincipalStore, }; use rstest::fixture; use rustical_store::auth::{AuthenticationProvider, Principal, PrincipalType}; @@ -9,12 +9,23 @@ use sqlx::SqlitePool; mod addressbook_store; mod calendar_store; -async fn get_test_db() -> SqlitePool { - let db = SqlitePool::connect("sqlite::memory:").await.unwrap(); - sqlx::migrate!("./migrations").run(&db).await.unwrap(); +#[derive(Debug, Clone)] +pub struct TestStoreContext { + pub db: SqlitePool, + pub addr_store: SqliteAddressbookStore, + pub cal_store: SqliteCalendarStore, + pub principal_store: SqlitePrincipalStore, + pub sub_store: SqliteStore, +} + +#[fixture] +pub async fn test_store_context() -> TestStoreContext { + let (send_addr, _recv) = tokio::sync::mpsc::channel(1); + let (send_cal, _recv) = tokio::sync::mpsc::channel(1); + let db = create_db_pool(":memory:", true).await.unwrap(); - // Populate with test data let principal_store = SqlitePrincipalStore::new(db.clone()); + // Populate with test data principal_store .insert_principal( Principal { @@ -33,28 +44,11 @@ async fn get_test_db() -> SqlitePool { .await .unwrap(); - db -} - -#[derive(Debug, Clone)] -pub struct TestStoreContext { - pub db: SqlitePool, - pub addr_store: SqliteAddressbookStore, - pub cal_store: SqliteCalendarStore, - pub principal_store: SqlitePrincipalStore, - pub sub_store: SqliteStore, -} - -#[fixture] -pub async fn test_store_context() -> TestStoreContext { - let (send_addr, _recv) = tokio::sync::mpsc::channel(1); - let (send_cal, _recv) = tokio::sync::mpsc::channel(1); - let db = get_test_db().await; TestStoreContext { db: db.clone(), addr_store: SqliteAddressbookStore::new(db.clone(), send_addr, false), cal_store: SqliteCalendarStore::new(db.clone(), send_cal, false), - principal_store: SqlitePrincipalStore::new(db.clone()), + principal_store, sub_store: SqliteStore::new(db), } } diff --git a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar__delete_body.snap b/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar__delete_body.snap deleted file mode 100644 index ae58472..0000000 --- a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar__delete_body.snap +++ /dev/null @@ -1,5 +0,0 @@ ---- -source: src/integration_tests/caldav/calendar.rs -expression: body ---- - diff --git a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar__mkcalendar_body.snap b/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar__mkcalendar_body.snap deleted file mode 100644 index ae58472..0000000 --- a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar__mkcalendar_body.snap +++ /dev/null @@ -1,5 +0,0 @@ ---- -source: src/integration_tests/caldav/calendar.rs -expression: body ---- - diff --git a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar_import__0_import_body.snap b/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar_import__0_import_body.snap deleted file mode 100644 index 5d87409..0000000 --- a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar_import__0_import_body.snap +++ /dev/null @@ -1,5 +0,0 @@ ---- -source: src/integration_tests/caldav/calendar_import.rs -expression: body ---- - diff --git a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar_import__1_import_body.snap b/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar_import__1_import_body.snap deleted file mode 100644 index 5d87409..0000000 --- a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar_import__1_import_body.snap +++ /dev/null @@ -1,5 +0,0 @@ ---- -source: src/integration_tests/caldav/calendar_import.rs -expression: body ---- - diff --git a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar_import__get_body.snap b/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar_import__get_body.snap deleted file mode 100644 index 9f34fbb..0000000 --- a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar_import__get_body.snap +++ /dev/null @@ -1,107 +0,0 @@ ---- -source: src/integration_tests/caldav/calendar_import.rs -expression: body ---- -BEGIN:VCALENDAR -VERSION:2.0 -CALSCALE:GREGORIAN -PRODID:RustiCal -BEGIN:VTIMEZONE -LAST-MODIFIED:20040110T032845Z -TZID:US/Eastern -BEGIN:DAYLIGHT -DTSTART:20000404T020000 -RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4 -TZNAME:EDT -TZOFFSETFROM:-0500 -TZOFFSETTO:-0400 -END:DAYLIGHT -BEGIN:STANDARD -DTSTART:20001026T020000 -RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10 -TZNAME:EST -TZOFFSETFROM:-0400 -TZOFFSETTO:-0500 -END:STANDARD -END:VTIMEZONE -BEGIN:VEVENT -DTSTAMP:20060206T001121Z -DTSTART;TZID=US/Eastern:20060104T140000 -DURATION:PT1H -RECURRENCE-ID;TZID=US/Eastern:20060104T120000 -SUMMARY:Event #2 bis -UID:[UID] -END:VEVENT -BEGIN:VEVENT -DTSTAMP:20060206T001102Z -DTSTART;TZID=US/Eastern:20060102T100000 -DURATION:PT1H -SUMMARY:Event #1 -Description:Go Steelers! -UID:[UID] -END:VEVENT -BEGIN:VEVENT -DTSTAMP:20060206T001121Z -DTSTART;TZID=US/Eastern:20060102T120000 -DURATION:PT1H -RRULE:FREQ=DAILY;COUNT=5 -SUMMARY:Event #2 -UID:[UID] -END:VEVENT -BEGIN:VEVENT -ATTENDEE;PARTSTAT=ACCEPTED;ROLE=CHAIR:mailto:cyrus@example.com -ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:lisa@example.com -DTSTAMP:20060206T001220Z -DTSTART;TZID=US/Eastern:20060104T100000 -DURATION:PT1H -LAST-MODIFIED:20060206T001330Z -ORGANIZER:mailto:cyrus@example.com -SEQUENCE:1 -STATUS:TENTATIVE -SUMMARY:Event #3 -UID:[UID] -END:VEVENT -BEGIN:VTODO -DTSTAMP:20060205T235335Z -DUE;VALUE=DATE:20060104 -STATUS:NEEDS-ACTION -SUMMARY:Task #1 -UID:[UID] -BEGIN:VALARM -ACTION:AUDIO -TRIGGER;RELATED=START:-PT10M -END:VALARM -END:VTODO -BEGIN:VTODO -DTSTAMP:20060205T235300Z -DUE;VALUE=DATE:20060106 -LAST-MODIFIED:20060205T235308Z -SEQUENCE:1 -STATUS:NEEDS-ACTION -SUMMARY:Task #2 -UID:[UID] -BEGIN:VALARM -ACTION:AUDIO -TRIGGER;RELATED=START:-PT10M -END:VALARM -END:VTODO -BEGIN:VTODO -COMPLETED:20051223T122322Z -DTSTAMP:20060205T235400Z -DUE;VALUE=DATE:20051225 -LAST-MODIFIED:20060205T235308Z -SEQUENCE:1 -STATUS:COMPLETED -SUMMARY:Task #3 -UID:[UID] -END:VTODO -BEGIN:VTODO -DTSTAMP:20060205T235600Z -DUE;VALUE=DATE:20060101 -LAST-MODIFIED:20060205T235308Z -SEQUENCE:1 -STATUS:CANCELLED -SUMMARY:Task #4 -UID:[UID] -END:VTODO -END:VCALENDAR diff --git a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar_import__import_body.snap b/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar_import__import_body.snap deleted file mode 100644 index 5d87409..0000000 --- a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar_import__import_body.snap +++ /dev/null @@ -1,5 +0,0 @@ ---- -source: src/integration_tests/caldav/calendar_import.rs -expression: body ---- - diff --git a/src/integration_tests/carddav/snapshots/rustical__integration_tests__carddav__addressbook__delete_body.snap b/src/integration_tests/carddav/snapshots/rustical__integration_tests__carddav__addressbook__delete_body.snap deleted file mode 100644 index e886956..0000000 --- a/src/integration_tests/carddav/snapshots/rustical__integration_tests__carddav__addressbook__delete_body.snap +++ /dev/null @@ -1,5 +0,0 @@ ---- -source: src/integration_tests/carddav/addressbook.rs -expression: body ---- - diff --git a/src/integration_tests/carddav/snapshots/rustical__integration_tests__carddav__addressbook__get_body.snap b/src/integration_tests/carddav/snapshots/rustical__integration_tests__carddav__addressbook__get_body.snap deleted file mode 100644 index e886956..0000000 --- a/src/integration_tests/carddav/snapshots/rustical__integration_tests__carddav__addressbook__get_body.snap +++ /dev/null @@ -1,5 +0,0 @@ ---- -source: src/integration_tests/carddav/addressbook.rs -expression: body ---- - diff --git a/src/integration_tests/carddav/snapshots/rustical__integration_tests__carddav__addressbook__mkcol_body.snap b/src/integration_tests/carddav/snapshots/rustical__integration_tests__carddav__addressbook__mkcol_body.snap deleted file mode 100644 index e886956..0000000 --- a/src/integration_tests/carddav/snapshots/rustical__integration_tests__carddav__addressbook__mkcol_body.snap +++ /dev/null @@ -1,5 +0,0 @@ ---- -source: src/integration_tests/carddav/addressbook.rs -expression: body ---- - diff --git a/src/integration_tests/carddav/snapshots/rustical__integration_tests__carddav__addressbook_import__get_body.snap b/src/integration_tests/carddav/snapshots/rustical__integration_tests__carddav__addressbook_import__get_body.snap deleted file mode 100644 index aa8d5df..0000000 --- a/src/integration_tests/carddav/snapshots/rustical__integration_tests__carddav__addressbook_import__get_body.snap +++ /dev/null @@ -1,13 +0,0 @@ ---- -source: src/integration_tests/carddav/addressbook_import.rs -expression: body ---- -BEGIN:VCARD -VERSION:4.0 -FN:Simon Perreault -N:Perreault;Simon;;;ing. jr,M.Sc. -BDAY:--0203 -GENDER:M -EMAIL;TYPE=work:simon.perreault@viagenie.ca -UID:[UID] -END:VCARD diff --git a/src/integration_tests/carddav/snapshots/rustical__integration_tests__carddav__addressbook_import__import_body.snap b/src/integration_tests/carddav/snapshots/rustical__integration_tests__carddav__addressbook_import__import_body.snap deleted file mode 100644 index 252904c..0000000 --- a/src/integration_tests/carddav/snapshots/rustical__integration_tests__carddav__addressbook_import__import_body.snap +++ /dev/null @@ -1,5 +0,0 @@ ---- -source: src/integration_tests/carddav/addressbook_import.rs -expression: body ---- - diff --git a/src/integration_tests/carddav/snapshots/rustical__integration_tests__carddav__carddav_root-2.snap b/src/integration_tests/carddav/snapshots/rustical__integration_tests__carddav__carddav_root-2.snap deleted file mode 100644 index 946c71e..0000000 --- a/src/integration_tests/carddav/snapshots/rustical__integration_tests__carddav__carddav_root-2.snap +++ /dev/null @@ -1,5 +0,0 @@ ---- -source: src/integration_tests/carddav/mod.rs -expression: body ---- - diff --git a/src/integration_tests/carddav/snapshots/rustical__integration_tests__carddav__carddav_root.snap b/src/integration_tests/carddav/snapshots/rustical__integration_tests__carddav__carddav_root.snap deleted file mode 100644 index 946c71e..0000000 --- a/src/integration_tests/carddav/snapshots/rustical__integration_tests__carddav__carddav_root.snap +++ /dev/null @@ -1,5 +0,0 @@ ---- -source: src/integration_tests/carddav/mod.rs -expression: body ---- - diff --git a/src/lib.rs b/src/lib.rs index d54050f..44eb89a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -26,8 +26,6 @@ pub mod app; mod commands; pub use commands::*; pub mod config; -#[cfg(test)] -pub mod integration_tests; mod setup_tracing; #[derive(Parser, Debug)] @@ -70,6 +68,7 @@ pub async fn get_data_stores( skip_broken, }) => { let db = create_db_pool(db_url, migrate).await?; + // Channel to watch for changes (for DAV Push) let (send, recv) = tokio::sync::mpsc::channel(1000); diff --git a/tests/common/mod.rs b/tests/common/mod.rs new file mode 100644 index 0000000..e69de29 diff --git a/src/integration_tests/caldav/calendar.rs b/tests/integration_tests/caldav/calendar.rs similarity index 99% rename from src/integration_tests/caldav/calendar.rs rename to tests/integration_tests/caldav/calendar.rs index ae3e005..cd6962b 100644 --- a/src/integration_tests/caldav/calendar.rs +++ b/tests/integration_tests/caldav/calendar.rs @@ -1,4 +1,4 @@ -use crate::integration_tests::{ResponseExtractString, get_app}; +use super::{ResponseExtractString, get_app}; use axum::body::Body; use axum::extract::Request; use headers::{Authorization, HeaderMapExt}; diff --git a/src/integration_tests/caldav/calendar_import.rs b/tests/integration_tests/caldav/calendar_import.rs similarity index 97% rename from src/integration_tests/caldav/calendar_import.rs rename to tests/integration_tests/caldav/calendar_import.rs index 689b0b8..68c2156 100644 --- a/src/integration_tests/caldav/calendar_import.rs +++ b/tests/integration_tests/caldav/calendar_import.rs @@ -1,4 +1,4 @@ -use crate::integration_tests::{ResponseExtractString, get_app}; +use super::{ResponseExtractString, get_app}; use axum::body::Body; use axum::extract::Request; use headers::{Authorization, HeaderMapExt}; diff --git a/src/integration_tests/caldav/calendar_put.rs b/tests/integration_tests/caldav/calendar_put.rs similarity index 95% rename from src/integration_tests/caldav/calendar_put.rs rename to tests/integration_tests/caldav/calendar_put.rs index ba4b818..fd1b836 100644 --- a/src/integration_tests/caldav/calendar_put.rs +++ b/tests/integration_tests/caldav/calendar_put.rs @@ -1,3 +1,4 @@ +use super::{ResponseExtractString, calendar::mkcalendar_template, get_app}; use axum::body::Body; use headers::{Authorization, HeaderMapExt}; use http::{Request, StatusCode}; @@ -6,10 +7,6 @@ use rustical_store::CalendarMetadata; use rustical_store_sqlite::tests::{TestStoreContext, test_store_context}; use tower::ServiceExt; -use crate::integration_tests::{ - ResponseExtractString, caldav::calendar::mkcalendar_template, get_app, -}; - #[rstest] #[tokio::test] async fn test_put_invalid( diff --git a/src/integration_tests/caldav/calendar_report.rs b/tests/integration_tests/caldav/calendar_report.rs similarity index 99% rename from src/integration_tests/caldav/calendar_report.rs rename to tests/integration_tests/caldav/calendar_report.rs index 02974ff..676b323 100644 --- a/src/integration_tests/caldav/calendar_report.rs +++ b/tests/integration_tests/caldav/calendar_report.rs @@ -1,4 +1,4 @@ -use crate::integration_tests::{ResponseExtractString, get_app}; +use super::{ResponseExtractString, get_app}; use axum::body::Body; use axum::extract::Request; use headers::{Authorization, HeaderMapExt}; diff --git a/src/integration_tests/caldav/mod.rs b/tests/integration_tests/caldav/mod.rs similarity index 98% rename from src/integration_tests/caldav/mod.rs rename to tests/integration_tests/caldav/mod.rs index 5d7d532..44627ed 100644 --- a/src/integration_tests/caldav/mod.rs +++ b/tests/integration_tests/caldav/mod.rs @@ -1,4 +1,4 @@ -use crate::integration_tests::{ResponseExtractString, get_app}; +use super::{ResponseExtractString, get_app}; use axum::body::Body; use axum::extract::Request; use headers::{Authorization, HeaderMapExt}; diff --git a/src/integration_tests/caldav/resources/rfc4791_appb.ics b/tests/integration_tests/caldav/resources/rfc4791_appb.ics similarity index 100% rename from src/integration_tests/caldav/resources/rfc4791_appb.ics rename to tests/integration_tests/caldav/resources/rfc4791_appb.ics diff --git a/tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__calendar__delete_body.snap b/tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__calendar__delete_body.snap new file mode 100644 index 0000000..6576a68 --- /dev/null +++ b/tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__calendar__delete_body.snap @@ -0,0 +1,5 @@ +--- +source: tests/integration_tests/caldav/calendar.rs +expression: body +--- + diff --git a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar__get_body.snap b/tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__calendar__get_body.snap similarity index 79% rename from src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar__get_body.snap rename to tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__calendar__get_body.snap index b336d9c..1239a64 100644 --- a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar__get_body.snap +++ b/tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__calendar__get_body.snap @@ -1,5 +1,5 @@ --- -source: src/integration_tests/caldav/calendar.rs +source: tests/integration_tests/caldav/calendar.rs expression: body --- BEGIN:VCALENDAR diff --git a/tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__calendar__mkcalendar_body.snap b/tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__calendar__mkcalendar_body.snap new file mode 100644 index 0000000..6576a68 --- /dev/null +++ b/tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__calendar__mkcalendar_body.snap @@ -0,0 +1,5 @@ +--- +source: tests/integration_tests/caldav/calendar.rs +expression: body +--- + diff --git a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar__multiget_body.snap b/tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__calendar__multiget_body.snap similarity index 93% rename from src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar__multiget_body.snap rename to tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__calendar__multiget_body.snap index 06d31c1..895aef3 100644 --- a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar__multiget_body.snap +++ b/tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__calendar__multiget_body.snap @@ -1,5 +1,5 @@ --- -source: src/integration_tests/caldav/calendar.rs +source: tests/integration_tests/caldav/calendar.rs expression: body --- diff --git a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar__propfind_body.snap b/tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__calendar__propfind_body.snap similarity index 99% rename from src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar__propfind_body.snap rename to tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__calendar__propfind_body.snap index 76468c2..5b99637 100644 --- a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar__propfind_body.snap +++ b/tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__calendar__propfind_body.snap @@ -1,5 +1,5 @@ --- -source: src/integration_tests/caldav/calendar.rs +source: tests/integration_tests/caldav/calendar.rs expression: body --- diff --git a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar__proppatch_body.snap b/tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__calendar__proppatch_body.snap similarity index 94% rename from src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar__proppatch_body.snap rename to tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__calendar__proppatch_body.snap index a06674d..154ace8 100644 --- a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar__proppatch_body.snap +++ b/tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__calendar__proppatch_body.snap @@ -1,5 +1,5 @@ --- -source: src/integration_tests/caldav/calendar.rs +source: tests/integration_tests/caldav/calendar.rs expression: body --- diff --git a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar_import__0_get_body.snap b/tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__calendar_import__0_get_body.snap similarity index 90% rename from src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar_import__0_get_body.snap rename to tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__calendar_import__0_get_body.snap index c031a57..ee4a130 100644 --- a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar_import__0_get_body.snap +++ b/tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__calendar_import__0_get_body.snap @@ -1,5 +1,5 @@ --- -source: src/integration_tests/caldav/calendar_import.rs +source: tests/integration_tests/caldav/calendar_import.rs expression: body --- BEGIN:VCALENDAR diff --git a/tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__calendar_import__0_import_body.snap b/tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__calendar_import__0_import_body.snap new file mode 100644 index 0000000..3d0388e --- /dev/null +++ b/tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__calendar_import__0_import_body.snap @@ -0,0 +1,5 @@ +--- +source: tests/integration_tests/caldav/calendar_import.rs +expression: body +--- + diff --git a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar_import__1_get_body.snap b/tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__calendar_import__1_get_body.snap similarity index 97% rename from src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar_import__1_get_body.snap rename to tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__calendar_import__1_get_body.snap index 059168d..8868bdf 100644 --- a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar_import__1_get_body.snap +++ b/tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__calendar_import__1_get_body.snap @@ -1,5 +1,5 @@ --- -source: src/integration_tests/caldav/calendar_import.rs +source: tests/integration_tests/caldav/calendar_import.rs expression: body --- BEGIN:VCALENDAR diff --git a/tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__calendar_import__1_import_body.snap b/tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__calendar_import__1_import_body.snap new file mode 100644 index 0000000..3d0388e --- /dev/null +++ b/tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__calendar_import__1_import_body.snap @@ -0,0 +1,5 @@ +--- +source: tests/integration_tests/caldav/calendar_import.rs +expression: body +--- + diff --git a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar_report__0_report_body.snap b/tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__calendar_report__0_report_body.snap similarity index 97% rename from src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar_report__0_report_body.snap rename to tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__calendar_report__0_report_body.snap index 79834cc..fff5086 100644 --- a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar_report__0_report_body.snap +++ b/tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__calendar_report__0_report_body.snap @@ -1,5 +1,5 @@ --- -source: src/integration_tests/caldav/calendar_report.rs +source: tests/integration_tests/caldav/calendar_report.rs expression: body --- diff --git a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar_report__1_report_body.snap b/tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__calendar_report__1_report_body.snap similarity index 97% rename from src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar_report__1_report_body.snap rename to tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__calendar_report__1_report_body.snap index 09add03..4e7e987 100644 --- a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar_report__1_report_body.snap +++ b/tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__calendar_report__1_report_body.snap @@ -1,5 +1,5 @@ --- -source: src/integration_tests/caldav/calendar_report.rs +source: tests/integration_tests/caldav/calendar_report.rs expression: body --- diff --git a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar_report__2_report_body.snap b/tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__calendar_report__2_report_body.snap similarity index 96% rename from src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar_report__2_report_body.snap rename to tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__calendar_report__2_report_body.snap index 0ae78e9..440eb38 100644 --- a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar_report__2_report_body.snap +++ b/tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__calendar_report__2_report_body.snap @@ -1,5 +1,5 @@ --- -source: src/integration_tests/caldav/calendar_report.rs +source: tests/integration_tests/caldav/calendar_report.rs expression: body --- diff --git a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__propfind_body.snap b/tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__propfind_body.snap similarity index 95% rename from src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__propfind_body.snap rename to tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__propfind_body.snap index 22a878d..56f0d39 100644 --- a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__propfind_body.snap +++ b/tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__propfind_body.snap @@ -1,5 +1,5 @@ --- -source: src/integration_tests/caldav/mod.rs +source: tests/integration_tests/caldav/mod.rs expression: body --- diff --git a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__propfind_depth_0.snap b/tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__propfind_depth_0.snap similarity index 97% rename from src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__propfind_depth_0.snap rename to tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__propfind_depth_0.snap index ff16872..3aa48d3 100644 --- a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__propfind_depth_0.snap +++ b/tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__propfind_depth_0.snap @@ -1,5 +1,5 @@ --- -source: src/integration_tests/caldav/mod.rs +source: tests/integration_tests/caldav/mod.rs expression: body --- diff --git a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__propfind_depth_1.snap b/tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__propfind_depth_1.snap similarity index 97% rename from src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__propfind_depth_1.snap rename to tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__propfind_depth_1.snap index ff16872..3aa48d3 100644 --- a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__propfind_depth_1.snap +++ b/tests/integration_tests/caldav/snapshots/light_integrations__integration_tests__caldav__propfind_depth_1.snap @@ -1,5 +1,5 @@ --- -source: src/integration_tests/caldav/mod.rs +source: tests/integration_tests/caldav/mod.rs expression: body --- diff --git a/src/integration_tests/carddav/addressbook.rs b/tests/integration_tests/carddav/addressbook.rs similarity index 99% rename from src/integration_tests/carddav/addressbook.rs rename to tests/integration_tests/carddav/addressbook.rs index 76d165e..5579a39 100644 --- a/src/integration_tests/carddav/addressbook.rs +++ b/tests/integration_tests/carddav/addressbook.rs @@ -1,4 +1,4 @@ -use crate::integration_tests::{ResponseExtractString, get_app}; +use super::{ResponseExtractString, get_app}; use axum::body::Body; use axum::extract::Request; use headers::{Authorization, HeaderMapExt}; diff --git a/src/integration_tests/carddav/addressbook_import.rs b/tests/integration_tests/carddav/addressbook_import.rs similarity index 92% rename from src/integration_tests/carddav/addressbook_import.rs rename to tests/integration_tests/carddav/addressbook_import.rs index ceb0343..74096e3 100644 --- a/src/integration_tests/carddav/addressbook_import.rs +++ b/tests/integration_tests/carddav/addressbook_import.rs @@ -1,4 +1,4 @@ -use crate::integration_tests::{ResponseExtractString, get_app}; +use super::{ResponseExtractString, get_app}; use axum::body::Body; use axum::extract::Request; use headers::{Authorization, HeaderMapExt}; @@ -27,11 +27,10 @@ async fn test_import( .body(Body::from( r"BEGIN:VCARD VERSION:4.0 -FN:Simon Perreault -N:Perreault;Simon;;;ing. jr,M.Sc. +FN:John Doe +N:Doe;John;;;, BDAY:--0203 GENDER:M -EMAIL;TYPE=work:simon.perreault@viagenie.ca END:VCARD", )) .unwrap() diff --git a/src/integration_tests/carddav/mod.rs b/tests/integration_tests/carddav/mod.rs similarity index 96% rename from src/integration_tests/carddav/mod.rs rename to tests/integration_tests/carddav/mod.rs index d4be4c8..8f80b26 100644 --- a/src/integration_tests/carddav/mod.rs +++ b/tests/integration_tests/carddav/mod.rs @@ -1,4 +1,4 @@ -use crate::integration_tests::{ResponseExtractString, get_app}; +use super::{ResponseExtractString, get_app}; use axum::body::Body; use axum::extract::Request; use headers::{Authorization, HeaderMapExt}; diff --git a/tests/integration_tests/carddav/snapshots/light_integrations__integration_tests__carddav__addressbook__delete_body.snap b/tests/integration_tests/carddav/snapshots/light_integrations__integration_tests__carddav__addressbook__delete_body.snap new file mode 100644 index 0000000..681c2c0 --- /dev/null +++ b/tests/integration_tests/carddav/snapshots/light_integrations__integration_tests__carddav__addressbook__delete_body.snap @@ -0,0 +1,5 @@ +--- +source: tests/integration_tests/carddav/addressbook.rs +expression: body +--- + diff --git a/tests/integration_tests/carddav/snapshots/light_integrations__integration_tests__carddav__addressbook__get_body.snap b/tests/integration_tests/carddav/snapshots/light_integrations__integration_tests__carddav__addressbook__get_body.snap new file mode 100644 index 0000000..681c2c0 --- /dev/null +++ b/tests/integration_tests/carddav/snapshots/light_integrations__integration_tests__carddav__addressbook__get_body.snap @@ -0,0 +1,5 @@ +--- +source: tests/integration_tests/carddav/addressbook.rs +expression: body +--- + diff --git a/tests/integration_tests/carddav/snapshots/light_integrations__integration_tests__carddav__addressbook__mkcol_body.snap b/tests/integration_tests/carddav/snapshots/light_integrations__integration_tests__carddav__addressbook__mkcol_body.snap new file mode 100644 index 0000000..681c2c0 --- /dev/null +++ b/tests/integration_tests/carddav/snapshots/light_integrations__integration_tests__carddav__addressbook__mkcol_body.snap @@ -0,0 +1,5 @@ +--- +source: tests/integration_tests/carddav/addressbook.rs +expression: body +--- + diff --git a/src/integration_tests/carddav/snapshots/rustical__integration_tests__carddav__addressbook__multiget_body.snap b/tests/integration_tests/carddav/snapshots/light_integrations__integration_tests__carddav__addressbook__multiget_body.snap similarity index 95% rename from src/integration_tests/carddav/snapshots/rustical__integration_tests__carddav__addressbook__multiget_body.snap rename to tests/integration_tests/carddav/snapshots/light_integrations__integration_tests__carddav__addressbook__multiget_body.snap index 11e19dd..2b7a740 100644 --- a/src/integration_tests/carddav/snapshots/rustical__integration_tests__carddav__addressbook__multiget_body.snap +++ b/tests/integration_tests/carddav/snapshots/light_integrations__integration_tests__carddav__addressbook__multiget_body.snap @@ -1,5 +1,5 @@ --- -source: src/integration_tests/carddav/addressbook.rs +source: tests/integration_tests/carddav/addressbook.rs expression: body --- diff --git a/src/integration_tests/carddav/snapshots/rustical__integration_tests__carddav__addressbook__propfind_body.snap b/tests/integration_tests/carddav/snapshots/light_integrations__integration_tests__carddav__addressbook__propfind_body.snap similarity index 98% rename from src/integration_tests/carddav/snapshots/rustical__integration_tests__carddav__addressbook__propfind_body.snap rename to tests/integration_tests/carddav/snapshots/light_integrations__integration_tests__carddav__addressbook__propfind_body.snap index 901b803..447500f 100644 --- a/src/integration_tests/carddav/snapshots/rustical__integration_tests__carddav__addressbook__propfind_body.snap +++ b/tests/integration_tests/carddav/snapshots/light_integrations__integration_tests__carddav__addressbook__propfind_body.snap @@ -1,5 +1,5 @@ --- -source: src/integration_tests/carddav/addressbook.rs +source: tests/integration_tests/carddav/addressbook.rs expression: body --- diff --git a/src/integration_tests/carddav/snapshots/rustical__integration_tests__carddav__addressbook__proppatch_body.snap b/tests/integration_tests/carddav/snapshots/light_integrations__integration_tests__carddav__addressbook__proppatch_body.snap similarity index 94% rename from src/integration_tests/carddav/snapshots/rustical__integration_tests__carddav__addressbook__proppatch_body.snap rename to tests/integration_tests/carddav/snapshots/light_integrations__integration_tests__carddav__addressbook__proppatch_body.snap index eaefeba..e6bcf8f 100644 --- a/src/integration_tests/carddav/snapshots/rustical__integration_tests__carddav__addressbook__proppatch_body.snap +++ b/tests/integration_tests/carddav/snapshots/light_integrations__integration_tests__carddav__addressbook__proppatch_body.snap @@ -1,5 +1,5 @@ --- -source: src/integration_tests/carddav/addressbook.rs +source: tests/integration_tests/carddav/addressbook.rs expression: body --- diff --git a/tests/integration_tests/carddav/snapshots/light_integrations__integration_tests__carddav__addressbook_import__get_body.snap b/tests/integration_tests/carddav/snapshots/light_integrations__integration_tests__carddav__addressbook_import__get_body.snap new file mode 100644 index 0000000..11556bf --- /dev/null +++ b/tests/integration_tests/carddav/snapshots/light_integrations__integration_tests__carddav__addressbook_import__get_body.snap @@ -0,0 +1,12 @@ +--- +source: tests/integration_tests/carddav/addressbook_import.rs +expression: body +--- +BEGIN:VCARD +VERSION:4.0 +FN:John Doe +N:Doe;John;;;, +BDAY:--0203 +GENDER:M +UID:[UID] +END:VCARD diff --git a/tests/integration_tests/carddav/snapshots/light_integrations__integration_tests__carddav__addressbook_import__import_body.snap b/tests/integration_tests/carddav/snapshots/light_integrations__integration_tests__carddav__addressbook_import__import_body.snap new file mode 100644 index 0000000..8b30a20 --- /dev/null +++ b/tests/integration_tests/carddav/snapshots/light_integrations__integration_tests__carddav__addressbook_import__import_body.snap @@ -0,0 +1,5 @@ +--- +source: tests/integration_tests/carddav/addressbook_import.rs +expression: body +--- + diff --git a/tests/integration_tests/carddav/snapshots/light_integrations__integration_tests__carddav__carddav_root-2.snap b/tests/integration_tests/carddav/snapshots/light_integrations__integration_tests__carddav__carddav_root-2.snap new file mode 100644 index 0000000..74d36a4 --- /dev/null +++ b/tests/integration_tests/carddav/snapshots/light_integrations__integration_tests__carddav__carddav_root-2.snap @@ -0,0 +1,5 @@ +--- +source: tests/integration_tests/carddav/mod.rs +expression: body +--- + diff --git a/src/integration_tests/carddav/snapshots/rustical__integration_tests__carddav__carddav_root-3.snap b/tests/integration_tests/carddav/snapshots/light_integrations__integration_tests__carddav__carddav_root-3.snap similarity index 95% rename from src/integration_tests/carddav/snapshots/rustical__integration_tests__carddav__carddav_root-3.snap rename to tests/integration_tests/carddav/snapshots/light_integrations__integration_tests__carddav__carddav_root-3.snap index 94daf7e..531151c 100644 --- a/src/integration_tests/carddav/snapshots/rustical__integration_tests__carddav__carddav_root-3.snap +++ b/tests/integration_tests/carddav/snapshots/light_integrations__integration_tests__carddav__carddav_root-3.snap @@ -1,5 +1,5 @@ --- -source: src/integration_tests/carddav/mod.rs +source: tests/integration_tests/carddav/mod.rs expression: body --- diff --git a/tests/integration_tests/carddav/snapshots/light_integrations__integration_tests__carddav__carddav_root.snap b/tests/integration_tests/carddav/snapshots/light_integrations__integration_tests__carddav__carddav_root.snap new file mode 100644 index 0000000..74d36a4 --- /dev/null +++ b/tests/integration_tests/carddav/snapshots/light_integrations__integration_tests__carddav__carddav_root.snap @@ -0,0 +1,5 @@ +--- +source: tests/integration_tests/carddav/mod.rs +expression: body +--- + diff --git a/src/integration_tests/mod.rs b/tests/integration_tests/mod.rs similarity index 96% rename from src/integration_tests/mod.rs rename to tests/integration_tests/mod.rs index 18a8514..c9ae81d 100644 --- a/src/integration_tests/mod.rs +++ b/tests/integration_tests/mod.rs @@ -1,7 +1,7 @@ -use crate::{app::make_app, config::NextcloudLoginConfig}; use axum::extract::Request; use axum::{body::Body, response::Response}; use rstest::rstest; +use rustical::{app::make_app, config::NextcloudLoginConfig}; use rustical_caldav::CalDavConfig; use rustical_frontend::FrontendConfig; use rustical_store_sqlite::tests::{TestStoreContext, test_store_context}; diff --git a/tests/light_integrations.rs b/tests/light_integrations.rs new file mode 100644 index 0000000..0721481 --- /dev/null +++ b/tests/light_integrations.rs @@ -0,0 +1 @@ +mod integration_tests;