| 490 | #[test] |
| 491 | #[file_serial] |
| 492 | fn test_delete_nonexistent_view() { |
| 493 | use tempfile::tempdir; |
| 494 | |
| 495 | let _guard = DirGuard::new(); |
| 496 | let temp = tempdir().unwrap(); |
| 497 | let repo_path = temp.path(); |
| 498 | |
| 499 | // Initialize a repository and drop to release lock |
| 500 | { |
| 501 | let _repo = Repository::init(repo_path).unwrap(); |
| 502 | } |
| 503 | |
| 504 | // Change to the repo directory |
| 505 | std::env::set_current_dir(repo_path).unwrap(); |
| 506 | |
| 507 | // Try to delete a non-existent view. The plain form routes |
| 508 | // through the service area; the refusal is the domain's. |
| 509 | let cmd = Delete::with_name("nonexistent"); |
| 510 | let result = cmd.run(); |
| 511 | assert!(result.is_err()); |
| 512 | match result.unwrap_err() { |
| 513 | CliError::ServiceRefusal { message } => { |
| 514 | assert!( |
| 515 | message.contains("view 'nonexistent' not found"), |
| 516 | "unexpected refusal: {message}" |
| 517 | ); |
| 518 | } |
| 519 | other => panic!("Expected the view-not-found refusal, got: {:?}", other), |
| 520 | } |
| 521 | } |
| 522 | |
| 523 | #[test] |
| 524 | #[file_serial] |