-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from adobe/test_multi_auth
Add a test case for multi auth with anon user
- Loading branch information
Showing
3 changed files
with
15 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,6 +75,12 @@ describe('Dark Alley auth', () => { | |
assert.strictEqual(users[0].email, '[email protected]'); | ||
}); | ||
|
||
it('authorized with user if email matches and anonymous if present', async () => { | ||
const users = await getUsers(reqs.siteMulti, env); | ||
assert.strictEqual(users[0].email, 'anonymous') | ||
assert.strictEqual(users[1].email, '[email protected]'); | ||
}); | ||
|
||
it('anonymous if ims fails', async () => { | ||
const users = await getUsers(reqs.media, env); | ||
assert.strictEqual(users[0].email, 'anonymous'); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,12 @@ const optsWithExpAuth = { | |
}), | ||
}; | ||
|
||
const optsWithMultiAuthAnon = { | ||
headers: new Headers({ | ||
'Authorization': `,Bearer [email protected]` | ||
}), | ||
}; | ||
|
||
const optsWithForceFail = { | ||
headers: new Headers({ | ||
'x-mock-fail': true, | ||
|
@@ -44,6 +50,7 @@ const reqs = { | |
folder: new Request('https://da.live/source/cq/Geometrixx/NFT/', optsWithExpAuth), | ||
file: new Request('https://da.live/source/cq/Geometrixx/NFT/Outreach.html', optsWithEmptyBearer), | ||
media: new Request('https://da.live/source/cq/Geometrixx/NFT/blockchain.png', optsWithForceFail), | ||
siteMulti: new Request('https://da.live/source/cq/Geometrixx', optsWithMultiAuthAnon), | ||
}; | ||
|
||
export default reqs; |