| 1 |
# Verify that all attributes owns a test |
| 2 |
|
| 3 |
use warnings; |
| 4 |
use Test::More; |
| 5 |
use strict; |
| 6 |
use Lemonldap::NG::Common::Conf::ReConstants; |
| 7 |
|
| 8 |
use_ok('Lemonldap::NG::Manager::Build::Attributes'); |
| 9 |
my $count = 1; |
| 10 |
|
| 11 |
my ( $attrs, $types ); |
| 12 |
ok( $attrs = Lemonldap::NG::Manager::Build::Attributes::attributes(), |
| 13 |
'Get attributes' ); |
| 14 |
ok( $types = Lemonldap::NG::Manager::Build::Attributes::types(), 'Get types' ); |
| 15 |
$count += 2; |
| 16 |
|
| 17 |
foreach my $attr ( keys %$attrs ) { |
| 18 |
next |
| 19 |
if ( $attr =~ /^virtualHosts|.*MetaDataNodes|keyNodes|applicationList$/ ); |
| 20 |
ok( ( |
| 21 |
ref( $attrs->{$attr}->{test} ) |
| 22 |
or ref( $types->{ $attrs->{$attr}->{type} }->{test} ) |
| 23 |
), |
| 24 |
"Test exists for $attr" |
| 25 |
); |
| 26 |
$count++; |
| 27 |
if ( $attr =~ qr/^$simpleHashKeys$/o ) { |
| 28 |
ok( ( |
| 29 |
ref $attrs->{$attr}->{keyTest} |
| 30 |
or ref $types->{ $attrs->{$attr}->{type} }->{keyTest} |
| 31 |
), |
| 32 |
"Key test for $attr" |
| 33 |
); |
| 34 |
$count++; |
| 35 |
} |
| 36 |
if ( $attr =~ qr/^$simpleHashKeys$/o |
| 37 |
or $attrs->{$attr}->{type} =~ /Container$/ ) |
| 38 |
{ |
| 39 |
if ( $attrs->{$attr}->{default} ) { |
| 40 |
ok( |
| 41 |
ref( $attrs->{$attr}->{default} ) eq 'HASH', |
| 42 |
"$attr default value is a hash ref" |
| 43 |
); |
| 44 |
$count++; |
| 45 |
} |
| 46 |
} |
| 47 |
} |
| 48 |
|
| 49 |
done_testing($count); |