Bugzilla – Attachment 75868 Details for
Bug 12027
Shibboleth authentication for staff client
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
BUG 12027 [QA Followup] - Update tests
BUG-12027-QA-Followup---Update-tests.patch (text/plain), 4.49 KB, created by
Martin Renvoize
on 2018-06-07 09:49:12 UTC
(
hide
)
Description:
BUG 12027 [QA Followup] - Update tests
Filename:
MIME Type:
Creator:
Martin Renvoize
Created:
2018-06-07 09:49:12 UTC
Size:
4.49 KB
patch
obsolete
>From bd9cdc16a2560d000ace457359425031902aad6f Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 28 Apr 2017 15:23:18 +0100 >Subject: [PATCH] BUG 12027 [QA Followup] - Update tests > >--- > C4/Auth_with_shibboleth.pm | 1 - > t/Auth_with_shibboleth.t | 63 ++++++++++++++++++++++++++++++++++++++-------- > 2 files changed, 53 insertions(+), 11 deletions(-) > >diff --git a/C4/Auth_with_shibboleth.pm b/C4/Auth_with_shibboleth.pm >index a6ab055c1d..ff358f661e 100644 >--- a/C4/Auth_with_shibboleth.pm >+++ b/C4/Auth_with_shibboleth.pm >@@ -134,7 +134,6 @@ sub _get_uri { > my $interface = C4::Context->interface; > $debug and warn "shibboleth interface: " . $interface; > >- my $return; > my $uri; > if ( $interface eq 'intranet' ) { > >diff --git a/t/Auth_with_shibboleth.t b/t/Auth_with_shibboleth.t >index 5022b008eb..641b77123b 100644 >--- a/t/Auth_with_shibboleth.t >+++ b/t/Auth_with_shibboleth.t >@@ -28,13 +28,17 @@ use C4::Context; > > BEGIN { > if ( check_install( module => 'Test::DBIx::Class' ) ) { >- plan tests => 11; >- } else { >- plan skip_all => "Need Test::DBIx::Class" >+ plan tests => 17; >+ } >+ else { >+ plan skip_all => "Need Test::DBIx::Class"; > } > } > >-use Test::DBIx::Class; >+use Test::DBIx::Class { >+ schema_class => 'Koha::Schema', >+ connect_info => [ 'dbi:SQLite:dbname=:memory:', '', '' ] >+}; > > # Mock Variables > my $matchpoint = 'userid'; >@@ -63,11 +67,16 @@ $context->mock( 'config', \&mockedConfig ); > > ### Mock ->preference > my $OPACBaseURL = "testopac.com"; >+my $staffClientBaseURL = "teststaff.com"; > $context->mock( 'preference', \&mockedPref ); > > ### Mock ->tz > $context->mock( 'timezone', sub { return 'local'; } ); > >+### Mock ->interface >+my $interface = 'opac'; >+$context->mock( 'interface', \&mockedInterface ); >+ > ## Mock Database > my $database = new Test::MockModule('Koha::Database'); > >@@ -250,15 +259,17 @@ subtest "checkpw_shib tests" => sub { > > }; > >-## _get_uri >+## _get_uri - opac > $OPACBaseURL = "testopac.com"; > is( C4::Auth_with_shibboleth::_get_uri(), > "https://testopac.com", "https opac uri returned" ); > > $OPACBaseURL = "http://testopac.com"; > my $result; >-warning_like { $result = C4::Auth_with_shibboleth::_get_uri() } >-[qr/Shibboleth requires OPACBaseURL to use the https protocol!/], >+warnings_are { $result = C4::Auth_with_shibboleth::_get_uri() }[ >+ "shibboleth interface: $interface", >+"Shibboleth requires OPACBaseURL/staffClientBaseURL to use the https protocol!" >+], > "improper protocol - received expected warning"; > is( $result, "https://testopac.com", "https opac uri returned" ); > >@@ -267,10 +278,34 @@ is( C4::Auth_with_shibboleth::_get_uri(), > "https://testopac.com", "https opac uri returned" ); > > $OPACBaseURL = undef; >-warning_like { $result = C4::Auth_with_shibboleth::_get_uri() } >-[qr/OPACBaseURL not set!/], >+warnings_are { $result = C4::Auth_with_shibboleth::_get_uri() } >+[ "shibboleth interface: $interface", "OPACBaseURL not set!" ], > "undefined OPACBaseURL - received expected warning"; >-is( $result, "https://", "https opac uri returned" ); >+is( $result, "https://", "https $interface uri returned" ); >+ >+## _get_uri - intranet >+$interface = 'intranet'; >+$staffClientBaseURL = "teststaff.com"; >+is( C4::Auth_with_shibboleth::_get_uri(), >+ "https://teststaff.com", "https $interface uri returned" ); >+ >+$staffClientBaseURL = "http://teststaff.com"; >+warnings_are { $result = C4::Auth_with_shibboleth::_get_uri() }[ >+ "shibboleth interface: $interface", >+"Shibboleth requires OPACBaseURL/staffClientBaseURL to use the https protocol!" >+], >+ "improper protocol - received expected warning"; >+is( $result, "https://teststaff.com", "https $interface uri returned" ); >+ >+$staffClientBaseURL = "https://teststaff.com"; >+is( C4::Auth_with_shibboleth::_get_uri(), >+ "https://teststaff.com", "https $interface uri returned" ); >+ >+$staffClientBaseURL = undef; >+warnings_are { $result = C4::Auth_with_shibboleth::_get_uri() } >+[ "shibboleth interface: $interface", "staffClientBaseURL not set!" ], >+ "undefined staffClientBaseURL - received expected warning"; >+is( $result, "https://", "https $interface uri returned" ); > > ## _get_shib_config > # Internal helper function, covered in tests above >@@ -295,9 +330,17 @@ sub mockedPref { > $return = $OPACBaseURL; > } > >+ if ( $param eq 'staffClientBaseURL' ) { >+ $return = $staffClientBaseURL; >+ } >+ > return $return; > } > >+sub mockedInterface { >+ return $interface; >+} >+ > sub mockedSchema { > return Schema(); > } >-- >2.14.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 12027
:
30373
|
30374
|
30375
|
30377
|
35553
|
35554
|
43371
|
43372
|
62523
|
62524
|
62823
|
62824
|
62825
|
73152
|
75868
|
79416
|
79417
|
79418
|
79419