refactor: rename aim to upm and extract appimage module
This commit is contained in:
parent
af13e98eb3
commit
863c57e473
117 changed files with 2622 additions and 887 deletions
49
crates/upm-core/tests/install_policy.rs
Normal file
49
crates/upm-core/tests/install_policy.rs
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
use std::path::Path;
|
||||
use upm_core::integration::policy::{IntegrationMode, resolve_install_policy};
|
||||
use upm_core::platform::{DistroFamily, HostCapabilities, InstallScope};
|
||||
|
||||
#[test]
|
||||
fn immutable_system_request_downgrades_to_user_when_allowed() {
|
||||
let capabilities = HostCapabilities::immutable_user_only();
|
||||
let policy =
|
||||
resolve_install_policy(DistroFamily::Immutable, InstallScope::System, &capabilities)
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(policy.scope, InstallScope::User);
|
||||
assert_eq!(policy.integration_mode, IntegrationMode::Degraded);
|
||||
assert!(!policy.warnings.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nix_system_request_is_denied() {
|
||||
let error = resolve_install_policy(
|
||||
DistroFamily::Nix,
|
||||
InstallScope::System,
|
||||
&HostCapabilities::default(),
|
||||
)
|
||||
.unwrap_err();
|
||||
|
||||
assert!(error.contains("not supported on Nix hosts"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn system_policy_uses_managed_payload_and_native_integration_roots() {
|
||||
let policy = resolve_install_policy(
|
||||
DistroFamily::Fedora,
|
||||
InstallScope::System,
|
||||
&HostCapabilities::default(),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(policy.scope, InstallScope::System);
|
||||
assert_eq!(policy.payload_root, Path::new("/opt/upm/appimages"));
|
||||
assert_eq!(
|
||||
policy.desktop_entry_root,
|
||||
Path::new("/usr/share/applications")
|
||||
);
|
||||
assert_eq!(
|
||||
policy.icon_root,
|
||||
Path::new("/usr/share/icons/hicolor/256x256/apps")
|
||||
);
|
||||
assert_eq!(policy.integration_mode, IntegrationMode::Full);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue