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

(-)a/t/db_dependent/api/v1/idp.t (-28 / +28 lines)
Lines 20-26 Link Here
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::NoWarnings;
22
use Test::NoWarnings;
23
use Test::More tests => 3;
23
use Test::More tests => 4;
24
use Test::Mojo;
24
use Test::Mojo;
25
use Test::Warn;
25
use Test::Warn;
26
use Mojo::JWT;
26
use Mojo::JWT;
Lines 285-327 subtest 'domain endpoint tests' => sub { Link Here
285
    $schema->storage->txn_rollback;
285
    $schema->storage->txn_rollback;
286
};
286
};
287
287
288
# subtest 'oauth login tests' => sub {
288
subtest 'oauth login tests' => sub {
289
#   plan tests => 4;
289
    plan tests => 4;
290
290
291
#   $schema->storage->txn_begin;
291
    $schema->storage->txn_begin;
292
292
293
#   Koha::Auth::Identity::Provider::Domains->delete;
293
    Koha::Auth::Identity::Provider::Domains->delete;
294
#   Koha::Auth::Identity::Providers->delete;
294
    Koha::Auth::Identity::Providers->delete;
295
295
296
#   my ( $borrowernumber, $session_id ) = create_user_and_session({ authorized => 1 });
296
    my ( $borrowernumber, $session_id ) = create_user_and_session( { authorized => 1 } );
297
297
298
#   my $t = Test::Mojo->new('Koha::REST::V1');
298
    my $t = Test::Mojo->new('Koha::REST::V1');
299
299
300
#   # Build provider
300
    # Build provider
301
#   my $tx = $t->ua->build_tx( POST => "/api/v1/auth/identity_providers", json => $oauth_provider_data );
301
    my $tx = $t->ua->build_tx( POST => "/api/v1/auth/identity_providers", json => $oauth_provider_data );
302
#   $tx->req->cookies( { name => 'CGISESSID', value => $session_id } );
302
    $tx->req->cookies( { name => 'CGISESSID', value => $session_id } );
303
#   $tx->req->env( { REMOTE_ADDR => $remote_address } );
303
    $tx->req->env( { REMOTE_ADDR => $remote_address } );
304
304
305
#   $t->request_ok($tx);
305
    $t->request_ok($tx);
306
#   my $provider_id = $t->tx->res->json->{identity_provider_id};
306
    my $provider_id = $t->tx->res->json->{identity_provider_id};
307
307
308
#   # Build domain
308
    # Build domain
309
#   $tx = $t->ua->build_tx( POST => "/api/v1/auth/identity_providers/$provider_id/domains", json => $domain_not_matching );
309
    $tx = $t->ua->build_tx(
310
#   $tx->req->cookies( { name => 'CGISESSID', value => $session_id } );
310
        POST => "/api/v1/auth/identity_providers/$provider_id/domains",
311
#   $tx->req->env( { REMOTE_ADDR => $remote_address } );
311
        json => $domain_not_matching
312
    );
313
    $tx->req->cookies( { name => 'CGISESSID', value => $session_id } );
314
    $tx->req->env( { REMOTE_ADDR => $remote_address } );
312
315
313
#   $t->request_ok($tx);
316
    $t->request_ok($tx);
314
317
315
#   t::lib::Mocks::mock_preference( 'RESTPublicAPI', 1 );
318
    t::lib::Mocks::mock_preference( 'RESTPublicAPI', 1 );
316
319
317
#   # Simulate server restart
320
    # Simulate server restart
318
#   $t = Test::Mojo->new('Koha::REST::V1');
321
    $t = Test::Mojo->new('Koha::REST::V1');
319
322
320
#   #$t->ua->max_redirects(10);
323
    $t->get_ok("/api/v1/public/oauth/login/oauth_test/opac")->status_is(302);
321
#   $t->get_ok("/api/v1/public/oauth/login/oauth_test/opac")
324
    $schema->storage->txn_rollback;
322
#     ->status_is(302);
325
};
323
#   $schema->storage->txn_rollback;
324
# };
325
326
326
sub create_user_and_session {
327
sub create_user_and_session {
327
328
328
- 

Return to bug 40736