55b892dca4
When we add a new identity provider and put some special characters in the Config or Mapping field, we got 500 error when we list the identity providers To test: 1. Apply this patch. 2. Add a new identity provider 2.1. fill the form 2.2. click on «Add default Oauth configuration» and on «Add default Oauth mapping» 2.3. put some special characters in Configuration and Mapping field 3. Save the form => Confirm the identity providers list is shown correctly Also prove t/db_dependent/api/v1/provider.t. Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
66 lines
1.9 KiB
Perl
Executable file
66 lines
1.9 KiB
Perl
Executable file
#!/usr/bin/env perl
|
|
|
|
# This file is part of Koha.
|
|
#
|
|
# Koha is free software; you can redistribute it and/or modify it
|
|
# under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# Koha is distributed in the hope that it will be useful, but
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with Koha; if not, see <http://www.gnu.org/licenses>.
|
|
|
|
use Modern::Perl;
|
|
|
|
use Test::More tests => 1;
|
|
use Test::Mojo;
|
|
use t::lib::TestBuilder;
|
|
use t::lib::Mocks;
|
|
|
|
use JSON qw(encode_json);
|
|
|
|
use C4::Budgets;
|
|
|
|
use Koha::Database;
|
|
|
|
my $schema = Koha::Database->new->schema;
|
|
my $builder = t::lib::TestBuilder->new();
|
|
|
|
t::lib::Mocks::mock_preference( 'RESTBasicAuth', 1 );
|
|
|
|
my $t = Test::Mojo->new('Koha::REST::V1');
|
|
|
|
subtest 'list() tests' => sub {
|
|
|
|
plan tests => 4;
|
|
|
|
$schema->storage->txn_begin;
|
|
|
|
my $superlibrarian =
|
|
$builder->build_object( { class => 'Koha::Patrons', value => { flags => 1 } } );
|
|
my $password = 'thePassword123';
|
|
$superlibrarian->set_password( { password => $password, skip_validation => 1 } );
|
|
$superlibrarian->discard_changes;
|
|
|
|
my $userid = $superlibrarian->userid;
|
|
|
|
$t->get_ok("//$userid:$password@/api/v1/auth/identity_providers")->status_is(200);
|
|
|
|
my $provider = $builder->build_object( { class => 'Koha::Auth::Identity::Providers' } );
|
|
|
|
$provider->set(
|
|
{
|
|
config => '{"some":"value","and":"élève"}',
|
|
mapping => '{"some":"value","and":"tréma"}'
|
|
}
|
|
)->store;
|
|
|
|
$t->get_ok("//$userid:$password@/api/v1/auth/identity_providers")->status_is(200);
|
|
|
|
$schema->storage->txn_rollback;
|
|
};
|