use std::fs; use finger::load_user_configs; #[test] fn loads_multiple_users_from_config_files() { let dir = tempfile::tempdir().expect("create tempdir"); let bob_path = dir.path().join("bob.config"); let nathan_path = dir.path().join("nathan.config"); fs::write( &bob_path, "Login: bob Name: Bob\nProject: {{json_url https://example.test/project repo_name}}\n", ) .expect("write bob config"); fs::write(&nathan_path, "{{url: https://example.test}}\n").expect("write nathan config"); let users = load_user_configs(dir.path()).expect("load user configs"); assert_eq!(users.len(), 2); assert_eq!(users.get("bob").map(|u| u.login.as_str()), Some("bob")); assert_eq!(users.get("nathan").map(|u| u.login.as_str()), Some("nathan")); }