forked from Apple-Actions/import-codesign-certs
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.test.ts
More file actions
95 lines (91 loc) · 2.04 KB
/
main.test.ts
File metadata and controls
95 lines (91 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import * as core from '@actions/core'
import * as exec from '@actions/exec'
import * as security from '../src/security.js'
test('imports p12 file', async () => {
const keychain: string = 'signing_temp'
const keychainPassword: string = Math.random().toString(36)
const p12FilePath: string = 'Certificates.p12'
const p12Password: string = 'password'
await security.installCertIntoTemporaryKeychain(
keychain,
true,
keychainPassword,
p12FilePath,
p12Password
)
await security.deleteKeychain(keychain)
expect(exec.exec).toHaveBeenNthCalledWith(
1,
'security',
['create-keychain', '-p', keychainPassword, 'signing_temp.keychain'],
expect.any(Object)
)
expect(exec.exec).toHaveBeenNthCalledWith(
2,
'security',
['set-keychain-settings', '-lut', '21600', 'signing_temp.keychain'],
expect.any(Object)
)
expect(exec.exec).toHaveBeenNthCalledWith(
3,
'security',
['unlock-keychain', '-p', keychainPassword, 'signing_temp.keychain'],
expect.any(Object)
)
expect(exec.exec).toHaveBeenNthCalledWith(
4,
'security',
[
'import',
p12FilePath,
'-k',
'signing_temp.keychain',
'-f',
'pkcs12',
'-A',
'-T',
'/usr/bin/codesign',
'-T',
'/usr/bin/security',
'-P',
p12Password
],
expect.any(Object)
)
expect(exec.exec).toHaveBeenNthCalledWith(
5,
'security',
[
'set-key-partition-list',
'-S',
'apple-tool:,apple:',
'-k',
keychainPassword,
'signing_temp.keychain'
],
undefined
)
expect(exec.exec).toHaveBeenNthCalledWith(
6,
'security',
[
'list-keychains',
'-d',
'user',
'-s',
'signing_temp.keychain',
'login.keychain'
],
expect.any(Object)
)
expect(exec.exec).toHaveBeenNthCalledWith(
7,
'security',
['delete-keychain', 'signing_temp.keychain'],
undefined
)
expect(core.setOutput).toHaveBeenCalledWith(
'security-response',
expect.stringContaining('security')
)
})