@@ -865,6 +865,79 @@ mod tests {
865865 assert ! ( result. is_ok( ) ) ;
866866 }
867867
868+ #[ test]
869+ fn test_invalid_revocation_actions_dir ( ) {
870+ let test_config = KeylimeConfig {
871+ agent : AgentConfig {
872+ enable_revocation_notifications : true ,
873+ revocation_actions_dir : "/invalid" . to_string ( ) ,
874+ ..Default :: default ( )
875+ } ,
876+ } ;
877+ let result = config_translate_keywords ( & test_config) ;
878+ // Expect error due to the inexistent directory
879+ assert ! ( result. is_err( ) ) ;
880+ let test_config = KeylimeConfig {
881+ agent : AgentConfig {
882+ enable_revocation_notifications : false ,
883+ revocation_actions_dir : "/invalid" . to_string ( ) ,
884+ ..Default :: default ( )
885+ } ,
886+ } ;
887+
888+ // Now unset enable_revocation_notifications and check that is allowed
889+ let result = config_translate_keywords ( & test_config) ;
890+ assert ! ( result. is_ok( ) ) ;
891+ }
892+
893+ #[ test]
894+ fn test_keylime_dir_option ( ) {
895+ let dir = tempfile:: tempdir ( )
896+ . expect ( "Failed to create temporary directory" ) ;
897+ let test_config = KeylimeConfig {
898+ agent : AgentConfig {
899+ keylime_dir : dir. path ( ) . display ( ) . to_string ( ) ,
900+ ..Default :: default ( )
901+ } ,
902+ } ;
903+
904+ let result = config_translate_keywords ( & test_config) ;
905+ assert ! ( result. is_ok( ) ) ;
906+ }
907+
908+ #[ test]
909+ fn test_invalid_api_versions ( ) {
910+ // Check that invalid API versions are ignored
911+ let test_config = KeylimeConfig {
912+ agent : AgentConfig {
913+ api_versions : "invalid.api" . to_string ( ) ,
914+ ..Default :: default ( )
915+ } ,
916+ } ;
917+ let result = config_translate_keywords ( & test_config) ;
918+ assert ! ( result. is_ok( ) ) ;
919+
920+ // Check that unsupported API versions are ignored
921+ let test_config = KeylimeConfig {
922+ agent : AgentConfig {
923+ api_versions : "['0.0']" . to_string ( ) ,
924+ ..Default :: default ( )
925+ } ,
926+ } ;
927+ let result = config_translate_keywords ( & test_config) ;
928+ assert ! ( result. is_ok( ) ) ;
929+
930+ // Check that 'latest' keyword is supported
931+ let test_config = KeylimeConfig {
932+ agent : AgentConfig {
933+ api_versions : "\" latest\" " . to_string ( ) ,
934+ ..Default :: default ( )
935+ } ,
936+ } ;
937+ let result = config_translate_keywords ( & test_config) ;
938+ assert ! ( result. is_ok( ) ) ;
939+ }
940+
868941 #[ test]
869942 fn test_translate_api_versions_latest_keyword ( ) {
870943 let test_config = KeylimeConfig {
0 commit comments