diff --git a/t/Test/Qpsmtpd/Plugin.pm b/t/Test/Qpsmtpd/Plugin.pm index 0aedb78..6693824 100644 --- a/t/Test/Qpsmtpd/Plugin.pm +++ b/t/Test/Qpsmtpd/Plugin.pm @@ -84,4 +84,27 @@ sub validate_password { return $deny, "$file - wrong password"; } +sub fake_config { + my $self = shift; + my $fake_config = {@_}; + $self->qp->hooks->{config} = [ + { + name => '___FakeHook___', + code => sub { + my ( $self, $txn, $conf ) = @_; + return DECLINED if ! exists $fake_config->{$conf}; + return OK, $fake_config->{$conf}; + }, + }, + ]; +} + +sub unfake_config { + my ( $self ) = @_; + $self->qp->hooks->{config} = [ + grep { $_->{name} ne '___FakeHook___' } + @{ $self->qp->hooks->{config} || [] } + ]; +} + 1; diff --git a/t/plugin_tests/content_log b/t/plugin_tests/content_log index af1b26c..c2aba0c 100644 --- a/t/plugin_tests/content_log +++ b/t/plugin_tests/content_log @@ -75,29 +75,6 @@ sub test_content_log_enabled { $self->unfake_config; } -sub fake_config { - my $self = shift; - my $fake_config = {@_}; - $self->qp->hooks->{config} = [ - { - name => '___FakeHook___', - code => sub { - my ( $self, $txn, $conf ) = @_; - return DECLINED if ! exists $fake_config->{$conf}; - return OK, $fake_config->{$conf}; - }, - }, - ]; -} - -sub unfake_config { - my ( $self ) = @_; - $self->qp->hooks->{config} = [ - grep { $_->{name} ne '___FakeHook___' } - @{ $self->qp->hooks->{config} || [] } - ]; -} - sub test_exclude { my ( $self ) = @_; ok( ! $self->exclude, 'exclude() default method returns false' );