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

(-)a/t/db_dependent/api/v1/patrons.t (-2 / +23 lines)
Lines 18-24 Link Here
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
20
21
use Test::More tests => 43;
21
use Test::More tests => 45;
22
use Test::Mojo;
22
use Test::Mojo;
23
use t::lib::TestBuilder;
23
use t::lib::TestBuilder;
24
use t::lib::Mocks;
24
use t::lib::Mocks;
Lines 62-67 my $borrower = $builder->build({ Link Here
62
    }
62
    }
63
});
63
});
64
64
65
my $librarian = $builder->build({
66
    source => 'Borrower',
67
    value => {
68
        branchcode   => $branchcode,
69
        categorycode => $categorycode,
70
        flags        => 16,
71
        password     => Koha::AuthUtils::hash_password("test"),
72
    }
73
});
74
65
$t->get_ok('/api/v1/patrons')
75
$t->get_ok('/api/v1/patrons')
66
  ->status_is(401);
76
  ->status_is(401);
67
77
Lines 82-87 $session2->param('ip', '127.0.0.1'); Link Here
82
$session2->param('lasttime', time());
92
$session2->param('lasttime', time());
83
$session2->flush;
93
$session2->flush;
84
94
95
my $session3 = C4::Auth::get_session('');
96
$session3->param('number', $librarian->{ borrowernumber });
97
$session3->param('id', $librarian->{ userid });
98
$session3->param('ip', '127.0.0.1');
99
$session3->param('lasttime', time());
100
$session3->flush;
101
85
my $tx = $t->ua->build_tx(GET => '/api/v1/patrons');
102
my $tx = $t->ua->build_tx(GET => '/api/v1/patrons');
86
$tx->req->cookies({name => 'CGISESSID', value => $session->id});
103
$tx->req->cookies({name => 'CGISESSID', value => $session->id});
87
$t->request_ok($tx)
104
$t->request_ok($tx)
Lines 209-212 $tx->req->cookies({name => 'CGISESSID', value => $session_nopermission->id}); Link Here
209
$t->request_ok($tx)
226
$t->request_ok($tx)
210
  ->status_is(200);
227
  ->status_is(200);
211
228
229
$tx = $t->ua->build_tx(PATCH => '/api/v1/patrons/'.$borrower->{borrowernumber}.'/password' => json => $password_obj);
230
$tx->req->cookies({name => 'CGISESSID', value => $session3->id});
231
$t->request_ok($tx)
232
  ->status_is(200);
233
212
$schema->storage->txn_rollback;
234
$schema->storage->txn_rollback;
213
- 

Return to bug 17006