lemonldap-ng/lemonldap-ng-manager/t/20-test-coverage.t

48 lines
1.3 KiB
Perl
Raw Normal View History

2016-01-07 12:40:24 +01:00
# Verify that all attributes owns a test
2016-01-04 13:34:25 +01:00
use Test::More;
use strict;
use Lemonldap::NG::Common::Conf::ReConstants;
2016-01-04 13:34:25 +01:00
use_ok('Lemonldap::NG::Manager::Build::Attributes');
my $count = 1;
my ( $attrs, $types );
ok( $attrs = Lemonldap::NG::Manager::Build::Attributes::attributes(),
'Get attributes' );
ok( $types = Lemonldap::NG::Manager::Build::Attributes::types(), 'Get types' );
$count += 2;
foreach my $attr ( keys %$attrs ) {
next if ( $attr =~ /^virtualHosts|.*MetaDataNodes|applicationList$/ );
2019-02-07 09:27:56 +01:00
ok( (
2016-01-04 13:34:25 +01:00
ref( $attrs->{$attr}->{test} )
or ref( $types->{ $attrs->{$attr}->{type} }->{test} )
),
"Test exists for $attr"
);
$count++;
if ( $attr =~ qr/^$simpleHashKeys$/o ) {
2019-02-07 09:27:56 +01:00
ok( (
2016-01-04 13:34:25 +01:00
ref $attrs->{$attr}->{keyTest}
or ref $types->{ $attrs->{$attr}->{type} }->{keyTest}
),
"Key test for $attr"
);
$count++;
}
2016-01-22 17:53:41 +01:00
if ( $attr =~ qr/^$simpleHashKeys$/o
or $attrs->{$attr}->{type} =~ /Container$/ )
{
if ( $attrs->{$attr}->{default} ) {
ok(
ref( $attrs->{$attr}->{default} ) eq 'HASH',
"$attr default value is a hash ref"
);
$count++;
}
}
2016-01-04 13:34:25 +01:00
}
done_testing($count);