virtmgr: Make new_with_debug_level() test-only

According to its documentation, the method is only intended to be used
by tests so only compile it when cfg(test) and limit its visibility to
its crate.

Add a test dedicated to the method so that other tests can be later
specialized for DP.

Test: atest virtualizationmanager_device_test
Change-Id: I01559d3a6ae3a1d8a3dcd5d8f1dc41835d15edce
diff --git a/virtualizationmanager/src/debug_config.rs b/virtualizationmanager/src/debug_config.rs
index cb7f5d0..a2ea40d 100644
--- a/virtualizationmanager/src/debug_config.rs
+++ b/virtualizationmanager/src/debug_config.rs
@@ -147,7 +147,7 @@
 }
 
 /// Debug configurations for both debug level and debug policy
-#[derive(Debug)]
+#[derive(Debug, Default)]
 pub struct DebugConfig {
     pub debug_level: DebugLevel,
     debug_policy_log: bool,
@@ -190,11 +190,6 @@
         }
 
         info!("Debug policy is disabled");
-        Self::new_with_debug_level(debug_level)
-    }
-
-    /// Creates a new DebugConfig with debug level. Only use this for test purpose.
-    pub fn new_with_debug_level(debug_level: DebugLevel) -> Self {
         Self {
             debug_level,
             debug_policy_log: false,
@@ -203,6 +198,12 @@
         }
     }
 
+    #[cfg(test)]
+    /// Creates a new DebugConfig with debug level. Only use this for test purpose.
+    pub(crate) fn new_with_debug_level(debug_level: DebugLevel) -> Self {
+        Self { debug_level, ..Default::default() }
+    }
+
     /// Get whether console output should be configred for VM to leave console and adb log.
     /// Caller should create pipe and prepare for receiving VM log with it.
     pub fn should_prepare_console_output(&self) -> bool {
@@ -324,4 +325,18 @@
 
         Ok(())
     }
+
+    #[test]
+    fn test_new_with_debug_level() -> Result<()> {
+        assert_eq!(
+            DebugConfig::new_with_debug_level(DebugLevel::NONE).debug_level,
+            DebugLevel::NONE
+        );
+        assert_eq!(
+            DebugConfig::new_with_debug_level(DebugLevel::FULL).debug_level,
+            DebugLevel::FULL
+        );
+
+        Ok(())
+    }
 }