Debian Codegraph @

debian/rust-vendor/selinux/src/policy/tests.rs

raw
1 #[test]
2 fn version_number() {
3 match super::version_number() {
4 Ok(version) => assert_ne!(version, 0),
5 Err(_err) => assert_eq!(crate::current_mode(), crate::SELinuxMode::NotRunning),
6 }
7 }
8
9 #[test]
10 fn policy_type() {
11 match super::policy_type() {
12 Ok(name) => assert!(!name.as_c_str().to_bytes().is_empty()),
13 Err(_err) => assert_eq!(crate::current_mode(), crate::SELinuxMode::NotRunning),
14 }
15 }
16
17 #[test]
18 fn root_path() {
19 let path = super::root_path().unwrap();
20 assert!(!path.as_os_str().is_empty());
21 assert!(path.exists() || crate::current_mode() == crate::SELinuxMode::NotRunning);
22 }
23
24 #[test]
25 fn current_policy_path() {
26 match super::current_policy_path() {
27 Ok(path) => {
28 assert!(!path.as_os_str().is_empty());
29 assert!(path.exists() || crate::current_mode() == crate::SELinuxMode::NotRunning);
30 }
31
32 Err(_err) => assert!(crate::current_mode() == crate::SELinuxMode::NotRunning),
33 }
34 }
35
36 #[test]
37 fn binary_policy_path() {
38 let path = super::binary_policy_path().unwrap();
39 assert!(!path.as_os_str().is_empty());
40 //assert!(path.exists() || crate::current_mode() == crate::SELinuxMode::NotRunning);
41 }
42
43 #[test]
44 fn load() {
45 let policy_bytes = [];
46 super::load(&policy_bytes).unwrap_err();
47 }
48
49 #[test]
50 fn make_and_load() {
51 super::make_and_load().unwrap_err();
52 }
53
54 #[test]
55 fn load_initial() {
56 super::load_initial().unwrap_err();
57 }
58
59 #[test]
60 fn set_root_path() {
61 let path = super::current_policy_path().unwrap();
62 super::set_root_path(path).unwrap();
63 }