Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
lemonldap-ng
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
244
Issues
244
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LemonLDAP NG
lemonldap-ng
Commits
93500b85
Commit
93500b85
authored
Oct 29, 2019
by
Xavier Guimard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update test lib to override host if needed
parent
fb74d03a
Pipeline
#6870
passed with stage
in 13 minutes and 10 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
11 deletions
+10
-11
lemonldap-ng-portal/t/test-lib.pm
lemonldap-ng-portal/t/test-lib.pm
+10
-11
No files found.
lemonldap-ng-portal/t/test-lib.pm
View file @
93500b85
...
...
@@ -140,8 +140,7 @@ sub count_sessions {
sub
getCache
{
require
Cache::
FileCache
;
return
Cache::
FileCache
->
new
(
{
return
Cache::
FileCache
->
new
(
{
namespace
=>
'
lemonldap-ng-session
',
cache_root
=>
$tmpDir
,
cache_depth
=>
0
,
...
...
@@ -333,10 +332,12 @@ Verify that the HTTP response contains valid JSON and returns the corresponding
sub
expectJSON
{
my
(
$res
)
=
@_
;
is
(
$res
->
[
0
],
200
,
'
HTTP code is 200
'
)
or
explain
(
$res
,
200
);
my
%hdr
=
@
{
$res
->
[
1
]};
like
(
$hdr
{'
Content-Type
'},
qr,^application/json,
i
,
'
Content-Type is JSON
'
)
or
explain
(
$res
);
my
%hdr
=
@
{
$res
->
[
1
]
};
like
(
$hdr
{'
Content-Type
'},
qr,^application/json,
i
,
'
Content-Type is JSON
'
)
or
explain
(
$res
);
my
$json
;
eval
{
$json
=
JSON::
from_json
(
$res
->
[
2
]
->
[
0
]
)
};
eval
{
$json
=
JSON::
from_json
(
$res
->
[
2
]
->
[
0
]
)
};
ok
(
not
(
$@
),
'
Content is valid JSON
'
);
count
(
3
);
return
$json
;
...
...
@@ -701,14 +702,13 @@ to test content I<(to launch a C<expectForm()> for example)>.
sub
_get
{
my
(
$self
,
$path
,
%args
)
=
@_
;
my
$res
=
$self
->
app
->
(
{
my
$res
=
$self
->
app
->
(
{
'
HTTP_ACCEPT
'
=>
$args
{
accept
}
||
'
application/json, text/plain, */*
',
'
HTTP_ACCEPT_LANGUAGE
'
=>
'
fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3
',
'
HTTP_CACHE_CONTROL
'
=>
'
max-age=0
',
(
$args
{
cookie
}
?
(
HTTP_COOKIE
=>
$args
{
cookie
}
)
:
()
),
'
HTTP_HOST
'
=>
'
auth.example.com
'
,
'
HTTP_HOST
'
=>
(
$args
{
host
}
?
$args
{
host
}
:
'
auth.example.com
'
)
,
'
HTTP_USER_AGENT
'
=>
'
Mozilla/5.0 (VAX-4000; rv:36.0) Gecko/20350101 Firefox
',
'
PATH_INFO
'
=>
$path
,
...
...
@@ -754,14 +754,13 @@ sub _post {
my
(
$self
,
$path
,
$body
,
%args
)
=
@_
;
die
"
$body
must be a IO::Handle
"
unless
(
ref
(
$body
)
and
$body
->
can
('
read
')
);
my
$res
=
$self
->
app
->
(
{
my
$res
=
$self
->
app
->
(
{
'
HTTP_ACCEPT
'
=>
$args
{
accept
}
||
'
application/json, text/plain, */*
',
'
HTTP_ACCEPT_LANGUAGE
'
=>
'
fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3
',
'
HTTP_CACHE_CONTROL
'
=>
'
max-age=0
',
(
$args
{
cookie
}
?
(
HTTP_COOKIE
=>
$args
{
cookie
}
)
:
()
),
'
HTTP_HOST
'
=>
'
auth.example.com
'
,
'
HTTP_HOST
'
=>
(
$args
{
host
}
?
$args
{
host
}
:
'
auth.example.com
'
)
,
'
HTTP_USER_AGENT
'
=>
'
Mozilla/5.0 (VAX-4000; rv:36.0) Gecko/20350101 Firefox
',
'
PATH_INFO
'
=>
$path
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment