View | Details | Raw Unified | Return to bug 26595
Collapse All | Expand All

(-)a/Koha/SMTP/Server.pm (+18 lines)
Lines 99-104 sub is_system_default { Link Here
99
    return $self->{_is_system_default};
99
    return $self->{_is_system_default};
100
}
100
}
101
101
102
=head3 to_api
103
104
    my $json = $smtp_server->to_api;
105
106
Overloaded method that returns a JSON representation of the Koha::SMTP::Server object,
107
suitable for API output.
108
109
=cut
110
111
sub to_api {
112
    my ( $self, $params ) = @_;
113
114
    my $json = $self->SUPER::to_api( $params );
115
    delete $json->{password};
116
117
    return $json;
118
}
119
102
=head3 to_api_mapping
120
=head3 to_api_mapping
103
121
104
This method returns the mapping for representing a Koha::SMTP::Server object
122
This method returns the mapping for representing a Koha::SMTP::Server object
(-)a/t/db_dependent/Koha/SMTP/Server.t (-2 / +13 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 2;
20
use Test::More tests => 3;
21
use Test::Exception;
21
use Test::Exception;
22
use Test::Warn;
22
use Test::Warn;
23
23
Lines 70-72 subtest 'is_system_default() tests' => sub { Link Here
70
70
71
    $schema->storage->txn_rollback;
71
    $schema->storage->txn_rollback;
72
};
72
};
73
- 
73
74
subtest 'to_api() tests' => sub {
75
76
    plan tests => 1;
77
78
    $schema->storage->txn_begin;
79
80
    my $smtp_server = $builder->build_object({ class => 'Koha::SMTP::Servers' });
81
    ok( !exists $smtp_server->to_api->{password}, 'Password is not part of the API representation' );
82
83
    $schema->storage->txn_rollback;
84
};

Return to bug 26595