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

(-)a/Koha/Auth/Identity/Provider.pm (-2 / +2 lines)
Lines 62-68 sub get_config { Link Here
62
    my ($self) = @_;
62
    my ($self) = @_;
63
63
64
    return try {
64
    return try {
65
        return decode_json( $self->config );
65
        return decode_json( Encode::encode_utf8( $self->config ) );
66
    }
66
    }
67
    catch {
67
    catch {
68
        Koha::Exceptions::Object::BadValue->throw("Error reading JSON data: $_");
68
        Koha::Exceptions::Object::BadValue->throw("Error reading JSON data: $_");
Lines 127-133 sub get_mapping { Link Here
127
    my ($self) = @_;
127
    my ($self) = @_;
128
128
129
    return try {
129
    return try {
130
        return decode_json( $self->mapping );
130
        return decode_json( Encode::encode_utf8( $self->mapping ) );
131
    }
131
    }
132
    catch {
132
    catch {
133
        Koha::Exceptions::Object::BadValue->throw("Error reading JSON data: $_");
133
        Koha::Exceptions::Object::BadValue->throw("Error reading JSON data: $_");
(-)a/t/db_dependent/api/v1/provider.t (-1 / +66 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/env perl
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18
use Modern::Perl;
19
20
use Test::More tests => 1;
21
use Test::Mojo;
22
use t::lib::TestBuilder;
23
use t::lib::Mocks;
24
25
use JSON qw(encode_json);
26
27
use C4::Budgets;
28
29
use Koha::Database;
30
31
my $schema  = Koha::Database->new->schema;
32
my $builder = t::lib::TestBuilder->new();
33
34
t::lib::Mocks::mock_preference( 'RESTBasicAuth', 1 );
35
36
my $t = Test::Mojo->new('Koha::REST::V1');
37
38
subtest 'list() tests' => sub {
39
40
    plan tests => 4;
41
42
    $schema->storage->txn_begin;
43
44
    my $superlibrarian =
45
        $builder->build_object( { class => 'Koha::Patrons', value => { flags => 1 } } );
46
    my $password = 'thePassword123';
47
    $superlibrarian->set_password( { password => $password, skip_validation => 1 } );
48
    $superlibrarian->discard_changes;
49
50
    my $userid = $superlibrarian->userid;
51
52
    $t->get_ok("//$userid:$password@/api/v1/auth/identity_providers")->status_is(200);
53
54
    my $provider = $builder->build_object( { class => 'Koha::Auth::Identity::Providers' } );
55
56
    $provider->set(
57
        {
58
            config  => '{"some":"value","and":"élève"}',
59
            mapping => '{"some":"value","and":"tréma"}'
60
        }
61
    )->store;
62
63
    $t->get_ok("//$userid:$password@/api/v1/auth/identity_providers")->status_is(200);
64
65
    $schema->storage->txn_rollback;
66
};

Return to bug 37157