mirror of
https://github.com/aws-actions/configure-aws-credentials.git
synced 2026-03-12 18:07:10 -04:00
fix: Updated token retrieval to use new API (#270)
* feat: OIDC provider (with PR comments) * feat: OIDC provider (with PR comments) * updated OIDC based on new GH API
This commit is contained in:
@@ -2,10 +2,8 @@ const core = require('@actions/core');
|
||||
const assert = require('assert');
|
||||
const aws = require('aws-sdk');
|
||||
const run = require('./index.js');
|
||||
const axios = require('axios');
|
||||
|
||||
jest.mock('@actions/core');
|
||||
jest.mock("axios");
|
||||
|
||||
const FAKE_ACCESS_KEY_ID = 'MY-AWS-ACCESS-KEY-ID';
|
||||
const FAKE_SECRET_ACCESS_KEY = 'MY-AWS-SECRET-ACCESS-KEY';
|
||||
@@ -91,6 +89,12 @@ describe('Configure AWS Credentials', () => {
|
||||
.fn()
|
||||
.mockImplementation(mockGetInput(DEFAULT_INPUTS));
|
||||
|
||||
core.getIDToken = jest
|
||||
.fn()
|
||||
.mockImplementation(() => {
|
||||
return "testtoken"
|
||||
});
|
||||
|
||||
mockStsCallerIdentity.mockReset();
|
||||
mockStsCallerIdentity
|
||||
.mockReturnValueOnce({
|
||||
@@ -571,7 +575,6 @@ describe('Configure AWS Credentials', () => {
|
||||
test('only role arn and region provided to use GH OIDC Token', async () => {
|
||||
process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN = 'test-token';
|
||||
process.env.ACTIONS_ID_TOKEN_REQUEST_URL = 'https://www.example.com/token/endpoint';
|
||||
axios.get.mockImplementation(() => Promise.resolve({ data: {value: "testtoken"} }));
|
||||
core.getInput = jest
|
||||
.fn()
|
||||
.mockImplementation(mockGetInput({'role-to-assume': ROLE_ARN, 'aws-region': FAKE_REGION}));
|
||||
@@ -592,7 +595,6 @@ describe('Configure AWS Credentials', () => {
|
||||
const CUSTOM_ROLE_DURATION = 1234;
|
||||
process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN = 'test-token';
|
||||
process.env.ACTIONS_ID_TOKEN_REQUEST_URL = 'https://www.example.com/token/endpoint';
|
||||
axios.get.mockImplementation(() => Promise.resolve({ data: {value: "testtoken"} }));
|
||||
core.getInput = jest
|
||||
.fn()
|
||||
.mockImplementation(mockGetInput({'role-to-assume': ROLE_ARN, 'aws-region': FAKE_REGION, 'role-duration-seconds': CUSTOM_ROLE_DURATION}));
|
||||
|
||||
Reference in New Issue
Block a user