mirror of
https://github.com/actions/setup-java.git
synced 2025-04-20 18:06:45 +00:00
✨ Support loading GPG private key from file path.
This commit is contained in:
parent
3019d15cad
commit
b9a18e1677
8 changed files with 86 additions and 35 deletions
|
@ -1,4 +1,5 @@
|
|||
import path = require('path');
|
||||
import fs = require('fs');
|
||||
import io = require('@actions/io');
|
||||
import exec = require('@actions/exec');
|
||||
|
||||
|
@ -41,6 +42,23 @@ describe('gpg tests', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('importKeyFromPath', () => {
|
||||
it('attempts to import private key from path and returns null key id on failure', async () => {
|
||||
const privateKey = 'KEY CONTENTS';
|
||||
const privateKeyPath = path.join(tempDir, 'test.asc');
|
||||
fs.writeFileSync(privateKeyPath, privateKey);
|
||||
const keyId = await gpg.importKeyFromPath(privateKeyPath);
|
||||
|
||||
expect(keyId).toBeNull();
|
||||
|
||||
expect(exec.exec).toHaveBeenCalledWith(
|
||||
'gpg',
|
||||
expect.anything(),
|
||||
expect.anything()
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('deleteKey', () => {
|
||||
it('deletes private key', async () => {
|
||||
const keyId = 'asdfhjkl';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue