Skip to content

Commit

Permalink
test: Fix MacOS Defender AV test
Browse files Browse the repository at this point in the history
  • Loading branch information
g-bougard committed Jul 4, 2024
1 parent db025d1 commit 192e7c8
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions t/tasks/inventory/macos/antivirus.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ use strict;
use warnings;
use lib 't/lib';

use UNIVERSAL::require;

use Test::Deep;
use Test::Exception;
use Test::More;
Expand All @@ -14,6 +16,8 @@ use GLPI::Agent::Task::Inventory::MacOS::AntiVirus;

my %av_tests = (
'defender-101.98.30' => {
_module => "Defender",
_funcion => "_getMSDefender",
COMPANY => "Microsoft",
NAME => "Microsoft Defender",
ENABLED => 1,
Expand All @@ -31,9 +35,13 @@ plan tests =>

my $inventory = GLPI::Test::Inventory->new();

foreach my $test (keys %av_tests) {
foreach my $test (sort keys %av_tests) {
my $module = "GLPI::Agent::Task::Inventory::MacOS::AntiVirus::".(delete $av_tests{$test}->{_module});
$module->require();
my $funct_name = $module."::".(delete $av_tests{$test}->{_funcion});
my $function = \&{$funct_name};
my $file = "resources/macos/antivirus/$test.json";
my $antivirus = GLPI::Agent::Task::Inventory::MacOS::AntiVirus::_getMSDefender(file => $file);
my $antivirus = &{$function}(file => $file);
cmp_deeply($antivirus, $av_tests{$test}, "$test: parsing");
lives_ok {
$inventory->addEntry(section => 'ANTIVIRUS', entry => $antivirus);
Expand Down

0 comments on commit 192e7c8

Please sign in to comment.