mirror of
https://github.com/micromdm/micromdm/
synced 2026-08-12 04:55:39 +08:00
32 lines
586 B
Go
32 lines
586 B
Go
package main
|
|
|
|
import "testing"
|
|
|
|
func TestLoadPushCerts(t *testing.T) {
|
|
keypath := "testdata/ProviderPrivateKey.key"
|
|
certpath := "testdata/pushcert.pem"
|
|
p12path := "testdata/pushcert.p12"
|
|
keysecret := "secret"
|
|
|
|
cfg := &config{
|
|
APNSPrivateKeyPath: keypath,
|
|
APNSCertificatePath: certpath,
|
|
APNSPrivateKeyPass: keysecret,
|
|
}
|
|
|
|
// test separate key and cert
|
|
cfg.loadPushCerts()
|
|
if cfg.err != nil {
|
|
t.Fatal(cfg.err)
|
|
}
|
|
|
|
// test p12 with secret
|
|
cfg.APNSCertificatePath = p12path
|
|
cfg.APNSPrivateKeyPath = ""
|
|
cfg.loadPushCerts()
|
|
if cfg.err != nil {
|
|
t.Fatal(cfg.err)
|
|
}
|
|
|
|
}
|