1
0
Fork 0
mirror of https://github.com/docker/login-action.git synced 2025-04-22 14:46:37 +02:00

Username required

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2020-10-16 18:24:41 +02:00
parent 4b15841c41
commit 1c2cf9942d
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7
4 changed files with 30 additions and 40 deletions

View file

@ -29,22 +29,22 @@ test('errors without password', async () => {
});
test('successful with only password', async () => {
const platSpy = jest.spyOn(osm, 'platform');
platSpy.mockImplementation(() => 'linux');
const setRegistrySpy: jest.SpyInstance = jest.spyOn(stateHelper, 'setRegistry');
const setLogoutSpy: jest.SpyInstance = jest.spyOn(stateHelper, 'setLogout');
const dockerSpy: jest.SpyInstance = jest.spyOn(docker, 'login');
dockerSpy.mockImplementation(() => {});
const password: string = 'groundcontrol';
process.env[`INPUT_PASSWORD`] = password;
const platSpy = jest.spyOn(osm, 'platform');
platSpy.mockImplementation(() => 'linux');
await run();
const setRegistrySpy: jest.SpyInstance = jest.spyOn(stateHelper, 'setRegistry');
const setLogoutSpy: jest.SpyInstance = jest.spyOn(stateHelper, 'setLogout');
const dockerSpy: jest.SpyInstance = jest.spyOn(docker, 'login');
dockerSpy.mockImplementation(() => {});
expect(setRegistrySpy).toHaveBeenCalledWith('');
expect(setLogoutSpy).toHaveBeenCalledWith('');
expect(dockerSpy).toHaveBeenCalledWith('', '', password);
const password: string = 'groundcontrol';
process.env[`INPUT_PASSWORD`] = password;
await run();
expect(setRegistrySpy).toHaveBeenCalledWith('');
expect(setLogoutSpy).toHaveBeenCalledWith('');
expect(dockerSpy).toHaveBeenCalledWith('', '', password);
});
test('calls docker login', async () => {
@ -66,7 +66,7 @@ test('calls docker login', async () => {
process.env[`INPUT_REGISTRY`] = registry;
const logout: string = 'true';
process.env['INPUT_LOGOUT'] = logout
process.env['INPUT_LOGOUT'] = logout;
await run();