general endpoint delete
This commit is contained in:
@@ -252,63 +252,3 @@ async fn test_update_table_data_clear_optional_fields(
|
||||
assert!(db_record.telefon.is_none());
|
||||
assert!(db_record.ulica.is_none());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
#[tokio::test]
|
||||
async fn test_update_table_data_max_length_fields(
|
||||
#[future] existing_record: (PgPool, i64),
|
||||
valid_request_template: HashMap<String, String>,
|
||||
) {
|
||||
let (pool, id) = existing_record.await;
|
||||
|
||||
let mut data = valid_request_template;
|
||||
data.insert("firma".into(), "a".repeat(255));
|
||||
data.insert("telefon".into(), "1".repeat(20));
|
||||
|
||||
let request = PutTableDataRequest {
|
||||
profile_name: "default".into(),
|
||||
table_name: "2025_adresar".into(),
|
||||
id,
|
||||
data,
|
||||
};
|
||||
|
||||
let _response = put_table_data(&pool, request).await.unwrap();
|
||||
|
||||
let db_record = sqlx::query!(r#"SELECT firma, telefon FROM "2025_adresar" WHERE id = $1"#, id)
|
||||
.fetch_one(&pool)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(db_record.firma.len(), 255);
|
||||
assert_eq!(db_record.telefon.unwrap().len(), 20);
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
#[tokio::test]
|
||||
async fn test_update_table_data_special_characters(
|
||||
#[future] existing_record: (PgPool, i64),
|
||||
valid_request_template: HashMap<String, String>,
|
||||
) {
|
||||
let (pool, id) = existing_record.await;
|
||||
|
||||
let mut data = valid_request_template;
|
||||
data.insert("ulica".into(), "Náměstí 28. října".into());
|
||||
data.insert("telefon".into(), "+420 123-456.789".into());
|
||||
|
||||
let request = PutTableDataRequest {
|
||||
profile_name: "default".into(),
|
||||
table_name: "2025_adresar".into(),
|
||||
id,
|
||||
data,
|
||||
};
|
||||
|
||||
let _response = put_table_data(&pool, request).await.unwrap();
|
||||
|
||||
let db_record = sqlx::query!(r#"SELECT ulica, telefon FROM "2025_adresar" WHERE id = $1"#, id)
|
||||
.fetch_one(&pool)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(db_record.ulica.unwrap(), "Náměstí 28. října");
|
||||
assert_eq!(db_record.telefon.unwrap(), "+420 123-456.789");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user