Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
persona
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hexang 息壤平台
persona
Commits
2aeaec83
Commit
2aeaec83
authored
12 years ago
by
Lloyd Hilaiel
Browse files
Options
Downloads
Patches
Plain Diff
add tests of idp_proxy and required configuration stuff to enable said tests
parent
f1448358
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/proxy-idp-test.js
+83
-0
83 additions, 0 deletions
tests/proxy-idp-test.js
with
83 additions
and
0 deletions
tests/proxy-idp-test.js
0 → 100755
+
83
−
0
View file @
2aeaec83
#!/usr/bin/env node
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
require
(
'
./lib/test_env.js
'
);
const
assert
=
require
(
'
assert
'
),
vows
=
require
(
'
vows
'
),
path
=
require
(
'
path
'
),
start_stop
=
require
(
'
./lib/start-stop.js
'
),
wsapi
=
require
(
'
./lib/wsapi.js
'
),
util
=
require
(
'
util
'
);
var
suite
=
vows
.
describe
(
'
delegated-primary
'
);
const
TEST_DOMAIN_PATH
=
path
.
join
(
__dirname
,
'
..
'
,
'
example
'
,
'
primary
'
,
'
.well-known
'
,
'
browserid
'
);
process
.
env
[
'
PROXY_IDPS
'
]
=
JSON
.
stringify
({
"
yahoo.com
"
:
"
example.domain
"
,
"
real.primary
"
:
"
example.com
"
,
// this should be ignored, because real.primary is a shimmed real primary, below
"
broken.primary
"
:
"
example.com
"
// this should fallback to secondary, because example.com is not a real primary
});
process
.
env
[
'
SHIMMED_PRIMARIES
'
]
=
'
example.domain|http://127.0.0.1:10005|
'
+
TEST_DOMAIN_PATH
+
'
,real.primary|http://127.0.0.1:10005|
'
+
TEST_DOMAIN_PATH
;
start_stop
.
addStartupBatches
(
suite
);
suite
.
addBatch
({
"
proxy_idp configuration
"
:
{
topic
:
wsapi
.
get
(
'
/wsapi/address_info
'
,
{
email
:
'
bartholomew@yahoo.com
'
}),
"
acts as delegated authority
"
:
function
(
err
,
r
)
{
assert
.
strictEqual
(
r
.
code
,
200
);
var
resp
=
JSON
.
parse
(
r
.
body
);
assert
.
strictEqual
(
resp
.
auth
,
"
http://127.0.0.1:10005/sign_in.html
"
);
assert
.
strictEqual
(
resp
.
prov
,
"
http://127.0.0.1:10005/provision.html
"
);
assert
.
strictEqual
(
resp
.
type
,
"
primary
"
);
}
}
});
suite
.
addBatch
({
"
if bigtent breaks
"
:
{
topic
:
wsapi
.
get
(
'
/wsapi/address_info
'
,
{
email
:
'
bartholomew@broken.primary
'
}),
"
we fallback to secondary validation, just because that's how the protocol works
"
:
function
(
err
,
r
)
{
assert
.
strictEqual
(
r
.
code
,
200
);
var
resp
=
JSON
.
parse
(
r
.
body
);
assert
.
strictEqual
(
resp
.
type
,
"
secondary
"
);
assert
.
strictEqual
(
resp
.
known
,
false
);
}
}
});
suite
.
addBatch
({
"
real primaries always override proxy_idp configuration
"
:
{
topic
:
wsapi
.
get
(
'
/wsapi/address_info
'
,
{
email
:
'
bartholomew@real.primary
'
}),
"
because we want real primaries to step up
"
:
function
(
err
,
r
)
{
assert
.
strictEqual
(
r
.
code
,
200
);
var
resp
=
JSON
.
parse
(
r
.
body
);
assert
.
strictEqual
(
resp
.
auth
,
"
http://127.0.0.1:10005/sign_in.html
"
);
assert
.
strictEqual
(
resp
.
prov
,
"
http://127.0.0.1:10005/provision.html
"
);
assert
.
strictEqual
(
resp
.
type
,
"
primary
"
);
}
}
});
start_stop
.
addShutdownBatches
(
suite
);
// run or export the suite.
if
(
process
.
argv
[
1
]
===
__filename
)
suite
.
run
();
else
suite
.
export
(
module
);
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment