|
Lines 117-129
subtest 'header_name tests' => sub {
Link Here
|
| 117 |
}; |
117 |
}; |
| 118 |
|
118 |
|
| 119 |
subtest 'header_value tests' => sub { |
119 |
subtest 'header_value tests' => sub { |
| 120 |
plan tests => 3; |
120 |
plan tests => 4; |
| 121 |
|
121 |
|
| 122 |
t::lib::Mocks::mock_config( $conf_csp_section, {} ); |
122 |
t::lib::Mocks::mock_config( $conf_csp_section, {} ); |
| 123 |
C4::Context->interface('opac'); |
123 |
C4::Context->interface('opac'); |
| 124 |
|
124 |
|
| 125 |
my $csp = Koha::ContentSecurityPolicy->new; |
125 |
my $csp = Koha::ContentSecurityPolicy->new; |
| 126 |
|
126 |
|
|
|
127 |
t::lib::Mocks::mock_config( $conf_csp_section, { opac => { csp_header_value => '' } } ); |
| 128 |
like( |
| 129 |
$csp->header_value, qr/^default-src 'self';.*_CSP_NONCE_/, |
| 130 |
'csp_header_value is retrieved from ContentSecurityPolicy.pm' |
| 131 |
); |
| 132 |
|
| 127 |
t::lib::Mocks::mock_config( $conf_csp_section, { opac => { csp_header_value => 'some value' } } ); |
133 |
t::lib::Mocks::mock_config( $conf_csp_section, { opac => { csp_header_value => 'some value' } } ); |
| 128 |
is( $csp->header_value, 'some value', 'csp_header_value is retrieved from koha-conf.xml' ); |
134 |
is( $csp->header_value, 'some value', 'csp_header_value is retrieved from koha-conf.xml' ); |
| 129 |
|
135 |
|
| 130 |
- |
|
|