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 281-323 subtest 'domain endpoint tests' => sub { Link Here
281
    $schema->storage->txn_rollback;
281
    $schema->storage->txn_rollback;
282
};
282
};
283
283
284
# subtest 'oauth login tests' => sub {
284
subtest 'oauth login tests' => sub {
285
#   plan tests => 4;
285
    plan tests => 4;
286
286
287
#   $schema->storage->txn_begin;
287
    $schema->storage->txn_begin;
288
288
289
#   Koha::Auth::Identity::Provider::Domains->delete;
289
    Koha::Auth::Identity::Provider::Domains->delete;
290
#   Koha::Auth::Identity::Providers->delete;
290
    Koha::Auth::Identity::Providers->delete;
291
291
292
#   my ( $borrowernumber, $session_id ) = create_user_and_session({ authorized => 1 });
292
    my ( $borrowernumber, $session_id ) = create_user_and_session( { authorized => 1 } );
293
293
294
#   my $t = Test::Mojo->new('Koha::REST::V1');
294
    my $t = Test::Mojo->new('Koha::REST::V1');
295
295
296
#   # Build provider
296
    # Build provider
297
#   my $tx = $t->ua->build_tx( POST => "/api/v1/auth/identity_providers", json => $oauth_provider_data );
297
    my $tx = $t->ua->build_tx( POST => "/api/v1/auth/identity_providers", json => $oauth_provider_data );
298
#   $tx->req->cookies( { name => 'CGISESSID', value => $session_id } );
298
    $tx->req->cookies( { name => 'CGISESSID', value => $session_id } );
299
#   $tx->req->env( { REMOTE_ADDR => $remote_address } );
299
    $tx->req->env( { REMOTE_ADDR => $remote_address } );
300
300
301
#   $t->request_ok($tx);
301
    $t->request_ok($tx);
302
#   my $provider_id = $t->tx->res->json->{identity_provider_id};
302
    my $provider_id = $t->tx->res->json->{identity_provider_id};
303
303
304
#   # Build domain
304
    # Build domain
305
#   $tx = $t->ua->build_tx( POST => "/api/v1/auth/identity_providers/$provider_id/domains", json => $domain_not_matching );
305
    $tx = $t->ua->build_tx(
306
#   $tx->req->cookies( { name => 'CGISESSID', value => $session_id } );
306
        POST => "/api/v1/auth/identity_providers/$provider_id/domains",
307
#   $tx->req->env( { REMOTE_ADDR => $remote_address } );
307
        json => $domain_not_matching
308
    );
309
    $tx->req->cookies( { name => 'CGISESSID', value => $session_id } );
310
    $tx->req->env( { REMOTE_ADDR => $remote_address } );
308
311
309
#   $t->request_ok($tx);
312
    $t->request_ok($tx);
310
313
311
#   t::lib::Mocks::mock_preference( 'RESTPublicAPI', 1 );
314
    t::lib::Mocks::mock_preference( 'RESTPublicAPI', 1 );
312
315
313
#   # Simulate server restart
316
    # Simulate server restart
314
#   $t = Test::Mojo->new('Koha::REST::V1');
317
    $t = Test::Mojo->new('Koha::REST::V1');
315
318
316
#   #$t->ua->max_redirects(10);
319
    $t->get_ok("/api/v1/public/oauth/login/oauth_test/opac")->status_is(302);
317
#   $t->get_ok("/api/v1/public/oauth/login/oauth_test/opac")
320
    $schema->storage->txn_rollback;
318
#     ->status_is(302);
321
};
319
#   $schema->storage->txn_rollback;
320
# };
321
322
322
sub create_user_and_session {
323
sub create_user_and_session {
323
324
324
- 

Return to bug 40736