-
Notifications
You must be signed in to change notification settings - Fork 125
/
registry.t
69 lines (58 loc) · 1.87 KB
/
registry.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/perl
use strict;
use warnings;
use utf8;
use lib 't';
use English qw(-no_match_vars);
use Test::More;
use Test::MockModule;
use FusionInventory::Test::Utils;
BEGIN {
# use mock modules for non-available ones
push @INC, 't/fake/windows' if $OSNAME ne 'MSWin32';
}
use FusionInventory::Agent::Task::Inventory::Input::Win32::Registry;
if ($OSNAME ne 'MSWin32') {
plan skip_all => "Depends on Windows";
} else {
plan tests => 8;
}
my @data;
@data = FusionInventory::Agent::Task::Inventory::Input::Win32::Registry::_getRegistryData(
registry => {
NAME => 'REGISTRY',
PARAM => {
NAME => 'CurrentVersion',
content => 'ProductId',
REGTREE => '2',
REGKEY => 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion'
}
}
);
ok(@data == 1, "unique entry");
ok($data[0]->{entry}{REGVALUE}, "unique entry: REGVALUE");
ok($data[0]->{entry}{NAME} eq 'CurrentVersion', "unique entry: NAME");
@data = FusionInventory::Agent::Task::Inventory::Input::Win32::Registry::_getRegistryData(
registry => {
NAME => 'REGISTRY',
PARAM => [
{
NAME => 'ProductID',
content => 'ProductId',
REGTREE => '2',
REGKEY => 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion'
},
{
NAME => 'CurrentVersion',
content => '*',
REGTREE => '2',
REGKEY => 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion'
}
]
}
);
ok(@data > 4, "Wildcare test");
ok($data[0]->{entry}{REGVALUE}, "Wildcare test: REGVALUE");
ok($data[0]->{entry}{NAME} eq 'ProductID', "Wildcare test NAME (1/3)");
ok($data[1]->{entry}{NAME} eq 'CurrentVersion', "Wildcare test NAME (2/3)");
ok($data[2]->{entry}{NAME} eq 'CurrentVersion', "Wildcare test NAME (3/3)");