MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / test_run_duplicate_view

Function test_run_duplicate_view

atomic-cli/src/commands/view/new.rs:761–794  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

759 #[test]
760 #[file_serial]
761 fn test_run_duplicate_view() {
762 use tempfile::tempdir;
763
764 let _guard = DirGuard::new();
765 let temp = tempdir().unwrap();
766 let repo_path = temp.path();
767
768 // Initialize a repository and drop to release lock
769 {
770 let _repo = Repository::init(repo_path).unwrap();
771 }
772
773 // Change to the repo directory
774 std::env::set_current_dir(repo_path).unwrap();
775
776 // Create the view first time
777 let cmd = New::with_name("duplicate");
778 assert!(cmd.run().is_ok());
779
780 // Try to create it again. The plain form routes through the
781 // service area; the refusal is the domain's.
782 let cmd = New::with_name("duplicate");
783 let result = cmd.run();
784 assert!(result.is_err());
785 match result.unwrap_err() {
786 CliError::ServiceRefusal { message } => {
787 assert!(
788 message.contains("view 'duplicate' already exists"),
789 "unexpected refusal: {message}"
790 );
791 }
792 other => panic!("Expected the duplicate-view refusal, got: {:?}", other),
793 }
794 }
795
796 #[test]
797 #[file_serial]

Callers

nothing calls this directly

Calls 4

initFunction · 0.50
unwrapMethod · 0.45
pathMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected