-
Notifications
You must be signed in to change notification settings - Fork 69
/
imagemounter_test.go
49 lines (38 loc) · 1.23 KB
/
imagemounter_test.go
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
package giDevice
import (
"encoding/base64"
"testing"
)
var imageMounterSrv ImageMounter
func setupImageMounterSrv(t *testing.T) {
setupLockdownSrv(t)
var err error
if lockdownSrv, err = dev.lockdownService(); err != nil {
t.Fatal(err)
}
// Once
// dev.Images()
if imageMounterSrv, err = lockdownSrv.ImageMounterService(); err != nil {
t.Fatal(err)
}
}
func Test_imageMounter_Images(t *testing.T) {
setupImageMounterSrv(t)
// imageSignatures, err := dev.Images()
imageSignatures, err := imageMounterSrv.Images("Developer")
if err != nil {
t.Fatal(err)
}
for i, imgSign := range imageSignatures {
t.Logf("%2d, %s", i+1, base64.StdEncoding.EncodeToString(imgSign))
}
}
func Test_imageMounter_UploadImageAndMount(t *testing.T) {
setupImageMounterSrv(t)
devImgPath := "/private/var/mobile/Media/PublicStaging/staging.dimage"
dmgPath := "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/14.4/DeveloperDiskImage.dmg"
signaturePath := "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/14.4/DeveloperDiskImage.dmg.signature"
if err := imageMounterSrv.UploadImageAndMount("Developer", devImgPath, dmgPath, signaturePath); err != nil {
t.Fatal(err)
}
}