More explicit explanations

This commit is contained in:
Jared Johnson 2014-12-24 18:06:22 -06:00
parent a5f786c986
commit a7fee58aad

View File

@ -119,8 +119,22 @@ sub run_plugin_tests {
}
sub fake_hook {
# Used to test core code against different potential plugins
# it will interact with
###########################################################################
# Inserts a given subroutine into the beginning of the set of hooks already
# in place. Used to test code against different potential plugins it will
# interact with. For example, to test behavior against various results of
# the data_post hook:
#
# $self->fake_hook('data_post',sub { return DECLINED };
# ok(...);
# $self->fake_hook('data_post',sub { return DENYSOFT };
# ok(...);
# $self->fake_hook('data_post',sub { return DENY };
# ok(...);
# $self->fake_hook('data_post',sub { return DENY_DISCONNECT };
# ok(...);
# $self->unfake_hook('data_post');
###########################################################################
my ( $self, $hook, $sub ) = @_;
unshift @{ $self->hooks->{$hook} ||= [] },
{
@ -138,7 +152,18 @@ sub unfake_hook {
}
sub fake_config {
####################################################################
# Used to test code against various possible configurations
# For example, to test against various possible config('me') values:
#
# $self->fake_config( me => '***invalid***' );
# ok(...);
# $self->fake_config( me => 'valid-nonfqdn' );
# ok(...);
# $self->fake_config( me => 'valid-fqdn.com');
# ok(...);
# $self->unfake_config();
####################################################################
my $self = shift;
my $fake_config = {@_};
$self->fake_hook( 'config',