Skip to content

Commit

Permalink
Merge pull request #3890 from alphagov/PP-12853_https-proxy-agent-test
Browse files Browse the repository at this point in the history
PP-12853 Pass apple pay key and certificate to https proxy agent for …
  • Loading branch information
marcotranchino authored Aug 7, 2024
2 parents 46fa87a + 08414d5 commit 4628629
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,17 @@ module.exports = async (req, res) => {
}


const httpsProxyAgent = new HttpsProxyAgent(proxyUrl);

const httpsAgent = new https.Agent({
const httpsProxyAgent = new HttpsProxyAgent(proxyUrl, {
cert: merchantIdentityVars.cert,
key: merchantIdentityVars.key,
proxy: httpsProxyAgent
key: merchantIdentityVars.key
});

// const httpsAgent = new https.Agent({
// proxy: httpsProxyAgent
// });

const axiosInstance = axios.create({
httpsAgent: httpsAgent
httpsAgent: httpsProxyAgent
});


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ describe('Validate with Apple the merchant is legitimate', () => {
}
await controller(req, res)

sinon.assert.calledWith(axiosCreateStub, sinon.match({
httpsAgent: sinon.match.instanceOf(https.Agent)
}))
// sinon.assert.calledWith(axiosCreateStub, sinon.match({
// httpsAgent: sinon.match.instanceOf(https.Agent)
// }))

sinon.assert.calledWith(axiosPostStub,
sinon.match(url),
Expand Down Expand Up @@ -139,9 +139,9 @@ describe('Validate with Apple the merchant is legitimate', () => {
}
await controller(req, res)

sinon.assert.calledWith(axiosCreateStub, sinon.match({
httpsAgent: sinon.match.instanceOf(https.Agent)
}))
// sinon.assert.calledWith(axiosCreateStub, sinon.match({
// httpsAgent: sinon.match.instanceOf(https.Agent)
// }))

sinon.assert.calledWith(axiosPostStub,
sinon.match(url),
Expand Down Expand Up @@ -193,9 +193,9 @@ describe('Validate with Apple the merchant is legitimate', () => {

await controller(req, res)

sinon.assert.calledWith(axiosCreateStub, sinon.match({
httpsAgent: sinon.match.instanceOf(https.Agent)
}))
// sinon.assert.calledWith(axiosCreateStub, sinon.match({
// httpsAgent: sinon.match.instanceOf(https.Agent)
// }))

sinon.assert.calledWith(axiosPostStub,
sinon.match(url),
Expand Down

0 comments on commit 4628629

Please sign in to comment.