mirror of
https://github.com/docker/login-action.git
synced 2025-04-22 14:46:37 +02:00
Handle AWS credentials
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
39ef12fb7a
commit
5df5104555
9 changed files with 82 additions and 47 deletions
|
@ -2,20 +2,7 @@ import osm = require('os');
|
|||
|
||||
import {getInputs} from '../src/context';
|
||||
|
||||
test('without username getInputs throws errors', async () => {
|
||||
expect(() => {
|
||||
getInputs();
|
||||
}).toThrowError('Input required and not supplied: username');
|
||||
});
|
||||
|
||||
test('without password getInputs throws errors', async () => {
|
||||
process.env['INPUT_USERNAME'] = 'dbowie';
|
||||
expect(() => {
|
||||
getInputs();
|
||||
}).toThrowError('Input required and not supplied: password');
|
||||
});
|
||||
|
||||
test('with password and username getInputs does not error', async () => {
|
||||
test('with password and username getInputs does not throw error', async () => {
|
||||
process.env['INPUT_USERNAME'] = 'dbowie';
|
||||
process.env['INPUT_PASSWORD'] = 'groundcontrol';
|
||||
expect(() => {
|
||||
|
|
|
@ -17,7 +17,7 @@ test('errors when not run on linux platform', async () => {
|
|||
expect(coreSpy).toHaveBeenCalledWith('Only supported on linux platform');
|
||||
});
|
||||
|
||||
test('errors without username', async () => {
|
||||
test('errors without username and password', async () => {
|
||||
const platSpy = jest.spyOn(osm, 'platform');
|
||||
platSpy.mockImplementation(() => 'linux');
|
||||
|
||||
|
@ -25,21 +25,7 @@ test('errors without username', async () => {
|
|||
|
||||
await run();
|
||||
|
||||
expect(coreSpy).toHaveBeenCalledWith('Input required and not supplied: username');
|
||||
});
|
||||
|
||||
test('errors without password', async () => {
|
||||
const platSpy = jest.spyOn(osm, 'platform');
|
||||
platSpy.mockImplementation(() => 'linux');
|
||||
|
||||
const coreSpy: jest.SpyInstance = jest.spyOn(core, 'setFailed');
|
||||
|
||||
const username: string = 'dbowie';
|
||||
process.env[`INPUT_USERNAME`] = username;
|
||||
|
||||
await run();
|
||||
|
||||
expect(coreSpy).toHaveBeenCalledWith('Input required and not supplied: password');
|
||||
expect(coreSpy).toHaveBeenCalledWith('Username and password required');
|
||||
});
|
||||
|
||||
test('successful with username and password', async () => {
|
||||
|
@ -79,7 +65,7 @@ test('calls docker login', async () => {
|
|||
const password: string = 'groundcontrol';
|
||||
process.env[`INPUT_PASSWORD`] = password;
|
||||
|
||||
const registry: string = 'https://ghcr.io';
|
||||
const registry: string = 'ghcr.io';
|
||||
process.env[`INPUT_REGISTRY`] = registry;
|
||||
|
||||
const logout: string = 'true';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue