Lines 120-126
subtest 'JWT' => sub {
Link Here
|
120 |
}; |
120 |
}; |
121 |
|
121 |
|
122 |
subtest 'testing _add_default_csrf_params with/without userenv (bug 27849)' => sub { |
122 |
subtest 'testing _add_default_csrf_params with/without userenv (bug 27849)' => sub { |
123 |
plan tests => 5; |
123 |
plan tests => 8; |
124 |
|
124 |
|
125 |
# Current userenv: userid == 42 |
125 |
# Current userenv: userid == 42 |
126 |
my $result = Koha::Token::_add_default_csrf_params({ session_id => '567' }); |
126 |
my $result = Koha::Token::_add_default_csrf_params({ session_id => '567' }); |
Lines 133-136
subtest 'testing _add_default_csrf_params with/without userenv (bug 27849)' => s
Link Here
|
133 |
$result = Koha::Token::_add_default_csrf_params({}); # pass no session_id |
133 |
$result = Koha::Token::_add_default_csrf_params({}); # pass no session_id |
134 |
is( $result->{session_id}, Koha::Token::DEFA_SESSION_ID, 'Check session id' ); |
134 |
is( $result->{session_id}, Koha::Token::DEFA_SESSION_ID, 'Check session id' ); |
135 |
is( $result->{id}, Koha::Token::DEFA_SESSION_USERID. '_'. $result->{session_id}, 'Check userid' ); |
135 |
is( $result->{id}, Koha::Token::DEFA_SESSION_USERID. '_'. $result->{session_id}, 'Check userid' ); |
|
|
136 |
|
137 |
# Empty anonymous userenv (see C4::Auth::check_cookie_auth) |
138 |
C4::Context->_new_userenv('ANON SESSION'); |
139 |
C4::Context->set_userenv( undef, q{} ); |
140 |
ok( C4::Context->userenv, "Userenv exists" ); |
141 |
$result = Koha::Token::_add_default_csrf_params( {} ); # pass no session_id |
142 |
is( $result->{session_id}, Koha::Token::DEFA_SESSION_ID, 'Check session id for anon session' ); |
143 |
is( |
144 |
$result->{id}, Koha::Token::DEFA_SESSION_USERID . '_' . $result->{session_id}, |
145 |
'Check userid for anon session' |
146 |
); |
136 |
}; |
147 |
}; |
137 |
- |
|
|