| 20 | |
| 21 | #[test] |
| 22 | fn valid_model_conversion() { |
| 23 | let model = Artifact::new(b"hello world".to_vec()); |
| 24 | let dto = control_panel_api::ArtifactDTO::from(model.clone()); |
| 25 | |
| 26 | assert_eq!(dto.id, Uuid::from_bytes(*model.id()).to_string()); |
| 27 | assert_eq!(dto.size, model.artifact().len() as u64); |
| 28 | assert_eq!( |
| 29 | dto.hash, |
| 30 | "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9".to_string() |
| 31 | ); |
| 32 | assert_eq!(dto.artifact, model.artifact()); |
| 33 | assert_eq!(dto.created_at, timestamp_to_rfc3339(&model.created_at())); |
| 34 | } |
| 35 | } |