refactor: move business logic out of presentation — ReadAssetFile, checksum, auth checks, MetadataValue conversions
This commit is contained in:
@@ -77,9 +77,6 @@ impl Harness {
|
||||
}
|
||||
}
|
||||
|
||||
fn valid_checksum() -> String {
|
||||
"a".repeat(64)
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn ingests_successfully() {
|
||||
@@ -93,7 +90,6 @@ async fn ingests_successfully() {
|
||||
uploader_id: user,
|
||||
client_device_id: "iphone-1".into(),
|
||||
filename: "photo.jpg".into(),
|
||||
checksum: valid_checksum(),
|
||||
target_path_id: path_id,
|
||||
file_size: 1024,
|
||||
data: Bytes::from(vec![0u8; 1024]),
|
||||
@@ -124,7 +120,6 @@ async fn rejects_quota_exceeded() {
|
||||
uploader_id: user,
|
||||
client_device_id: "iphone-1".into(),
|
||||
filename: "big.jpg".into(),
|
||||
checksum: valid_checksum(),
|
||||
target_path_id: path_id,
|
||||
file_size: 1024,
|
||||
data: Bytes::from(vec![0u8; 1024]),
|
||||
@@ -134,28 +129,6 @@ async fn rejects_quota_exceeded() {
|
||||
assert!(matches!(result, Err(DomainError::QuotaExceeded(_))));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn rejects_invalid_checksum() {
|
||||
let h = Harness::new();
|
||||
let user = SystemId::new();
|
||||
let path_id = h.setup_volume_and_path(user).await;
|
||||
|
||||
let handler = h.ingest_handler();
|
||||
let result = handler
|
||||
.execute(IngestAssetCommand {
|
||||
uploader_id: user,
|
||||
client_device_id: "iphone-1".into(),
|
||||
filename: "photo.jpg".into(),
|
||||
checksum: "tooshort".into(),
|
||||
target_path_id: path_id,
|
||||
file_size: 1024,
|
||||
data: Bytes::from(vec![0u8; 1024]),
|
||||
})
|
||||
.await;
|
||||
|
||||
assert!(matches!(result, Err(DomainError::Validation(_))));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn rejects_non_ingest_path() {
|
||||
let h = Harness::new();
|
||||
@@ -187,7 +160,6 @@ async fn rejects_non_ingest_path() {
|
||||
uploader_id: user,
|
||||
client_device_id: "iphone-1".into(),
|
||||
filename: "photo.jpg".into(),
|
||||
checksum: valid_checksum(),
|
||||
target_path_id: path.path_id,
|
||||
file_size: 1024,
|
||||
data: Bytes::from(vec![0u8; 1024]),
|
||||
|
||||
Reference in New Issue
Block a user