Skip to content

Commit 54d202b

Browse files
committed
Add test for file with incorrect password
1 parent a43e0af commit 54d202b

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

test/fixtures/bad-password.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bad

test/signcode-test.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,25 @@ describe('signcode', function () {
138138
})
139139
})
140140

141+
it('calls back with an error when a file with an incorrect password is specified', function (done) {
142+
var tempPath = temp.path({suffix: '.exe'})
143+
fs.writeFileSync(tempPath, fs.readFileSync(path.join(__dirname, 'fixtures', 'electron.exe')))
144+
145+
var options = {
146+
cert: path.join(__dirname, 'fixtures', 'cert-with-pw.pem'),
147+
hash: ['sha1', 'sha256'],
148+
key: path.join(__dirname, 'fixtures', 'key-with-pw.pem'),
149+
passwordPath: path.join(__dirname, 'fixtures', 'bad-password.txt'),
150+
path: tempPath
151+
}
152+
153+
signcode.sign(options, function (error) {
154+
console.log(error.message);
155+
assert(error.message.length > 0)
156+
done()
157+
})
158+
})
159+
141160
it('calls back with an error when a non-existent password file is specified', function (done) {
142161
var tempPath = temp.path({suffix: '.exe'})
143162
fs.writeFileSync(tempPath, fs.readFileSync(path.join(__dirname, 'fixtures', 'electron.exe')))

0 commit comments

Comments
 (0)