Skip to content

Commit

Permalink
Update sqlite.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
thebino authored Oct 26, 2023
1 parent b27e8eb commit 32039a1
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions crates/database/src/sqlite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ mod tests {
let user_id = "570DC079-664A-4496-BAA3-668C445A447";
// create fake user - used as FOREIGN KEY in media
sqlx::query("INSERT INTO users (uuid, email, password, lastname, firstname) VALUES ($1, $2, $3, $4, $5)")
.bind(user_id.clone())
.bind(user_id)
.bind("[email protected]")
.bind("unsecure")
.bind("Stuermer")
Expand All @@ -437,7 +437,7 @@ mod tests {

// when
let media_item_result = db
.create_media_item(user_id.clone(), name, date_taken)
.create_media_item(user_id, name, date_taken)
.await;

// then
Expand All @@ -459,16 +459,16 @@ mod tests {

// create fake user - used as FOREIGN KEY in media
sqlx::query("INSERT INTO users (uuid, email, password, lastname, firstname) VALUES ($1, $2, $3, $4, $5)")
.bind(user_id.clone())
.bind(user_id)
.bind("[email protected]")
.bind("unsecure")
.bind("Stuermer")
.bind("Benjamin")
.execute(&pool).await?;

sqlx::query("INSERT INTO media (uuid, owner, name, is_sensitive, added_at, taken_at) VALUES ($1, $2, $3, $4, $5, $6)")
.bind(media_id.clone())
.bind(user_id.clone())
.bind(media_id)
.bind(user_id)
.bind("DSC_1234")
.bind(false)
.bind(added_at)
Expand All @@ -481,7 +481,7 @@ mod tests {
.await;

// when
let media_item_result = db.create_media_item(user_id.clone(), name, taken_at).await;
let media_item_result = db.create_media_item(user_id, name, taken_at).await;

// then
assert!(media_item_result.is_ok());
Expand All @@ -501,16 +501,16 @@ mod tests {
let taken_at = OffsetDateTime::parse("2023-01-01T13:37:01.234567Z", &Rfc3339).unwrap();
// create fake user - used as FOREIGN KEY in reference
sqlx::query("INSERT INTO users (uuid, email, password, lastname, firstname) VALUES ($1, $2, $3, $4, $5)")
.bind(user_id.clone())
.bind(user_id)
.bind("[email protected]")
.bind("unsecure")
.bind("Stuermer")
.bind("Benjamin")
.execute(&pool).await?;
// create fake media item - used as FOREIGN KEY in reference
sqlx::query("INSERT INTO media (uuid, owner, name, is_sensitive, added_at, taken_at) VALUES ($1, $2, $3, $4, $5, $6)")
.bind(media_id.clone())
.bind(user_id.clone())
.bind(media_id)
.bind(user_id)
.bind("DSC_1234")
.bind(false)
.bind(added_at)
Expand Down Expand Up @@ -540,7 +540,7 @@ mod tests {

// when
let add_reference_result = db
.add_reference(user_id.clone(), media_id.clone(), &reference)
.add_reference(user_id, media_id, &reference)
.await;

// then
Expand Down

0 comments on commit 32039a1

Please sign in to comment.