-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cb7ab32
commit 67f7177
Showing
9 changed files
with
133 additions
and
55 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 |
---|---|---|
|
@@ -23,11 +23,11 @@ import { INSTANCE_ID } from '../react/actions/__tests__/utils/testUtil'; | |
//Subject Under Testing | ||
const SUT = jest.fn(); | ||
const instanceId = INSTANCE_ID; | ||
const accountName = 'Veeam-Account'; | ||
const accountName = 'Veeam'; | ||
const accountNameAlreadyExist = 'Veeam-Account-Error'; | ||
const accountEmail = '[email protected]'; | ||
const accountId = '749861052561'; | ||
const bucketName = 'Veeam-Bucket'; | ||
export const bucketName = 'veeam'; | ||
const bucketNameWithErrorTriggered = 'Veeam-Bucket-Error'; | ||
const userName = 'Veeam-User'; | ||
const userNameWithErrorTriggered = 'Veeam-User-Error'; | ||
|
@@ -91,6 +91,14 @@ export const getVeeamMutationHandler = () => [ | |
//@ts-ignore | ||
const params = new URLSearchParams(req.body); | ||
SUT(params); | ||
// Assume Role | ||
if (params.get('Action') === 'AssumeRoleWithWebIdentity') { | ||
return res( | ||
ctx.status(200), | ||
ctx.xml(` | ||
<AssumeRoleWithWebIdentityResponse xmlns="https://iam.amazonaws.com/doc/2010-05-08/"><AssumeRoleWithWebIdentityResult><AssumedRoleUser><Arn>arn:aws:sts::${accountId}:assumed-role/storage-manager-role/ui-9160673b-2c2a-4a6f-a1ef-a3cb6ce25d7f</Arn><AssumedRoleId>OES3SPDIYW4L92S8K1QE6MINE31LQG04:ui-9160673b-2c2a-4a6f-a1ef-a3cb6ce25d7f</AssumedRoleId></Assum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Z</Expiration></Credentials><Provider>www.scality.com</Provider></AssumeRoleWithWebIdentityResult><ResponseMetadata><RequestId>8e94c64ebf4486567b0e</RequestId></ResponseMetadata></AssumeRoleWithWebIdentityResponse>`), | ||
); | ||
} | ||
if (params.get('Action') === 'CreateUser') { | ||
if (params.get('UserName') === userNameWithErrorTriggered) { | ||
return res( | ||
|
@@ -133,6 +141,7 @@ export const getVeeamMutationHandler = () => [ | |
); | ||
} | ||
return res( | ||
ctx.status(200), | ||
ctx.xml(` | ||
<AttachUserPolicyResponse xmlns="https://iam.amazonaws.com/doc/2010-05-08/"> | ||
<ResponseMetadata> | ||
|
@@ -171,8 +180,9 @@ export const getVeeamMutationHandler = () => [ | |
); | ||
} | ||
}), | ||
// putBucketTagging | ||
|
||
rest.put(`${TEST_API_BASE_URL}/${bucketName}`, (req, res, ctx) => { | ||
// putBucketTagging | ||
if (req.url.searchParams.get('tagging') === '') { | ||
SUT(req.body); | ||
return res( | ||
|
@@ -185,6 +195,8 @@ export const getVeeamMutationHandler = () => [ | |
`), | ||
); | ||
} | ||
//create bucket | ||
return res(ctx.status(200)); | ||
}), | ||
rest.put( | ||
`${TEST_API_BASE_URL}/${bucketNameWithErrorTriggered}`, | ||
|
@@ -201,6 +213,20 @@ export const getVeeamMutationHandler = () => [ | |
}, | ||
), | ||
// putObject | ||
rest.put( | ||
`${TEST_API_BASE_URL}/${bucketName}/${VEEAM_XML_PREFIX}`, | ||
(req, res, ctx) => { | ||
SUT(req.body); | ||
return res(ctx.status(200)); | ||
}, | ||
), | ||
rest.put( | ||
`${TEST_API_BASE_URL}/${bucketName}/${VEEAM_XML_PREFIX}/capacity.xml`, | ||
(req, res, ctx) => { | ||
SUT(req.body); | ||
return res(ctx.status(200)); | ||
}, | ||
), | ||
rest.put( | ||
`${TEST_API_BASE_URL}/${bucketName}/${veeamObjectKey}`, | ||
(req, res, ctx) => { | ||
|
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
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
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
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