mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 19:17:10 +00:00
test(doctor): trim redundant signing-check test
This commit is contained in:
1 parent
d6d7f7074f
commit
4bdb0e8934
1 file changed
+13
-20
@@ -6,8 +6,6 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"flag"
|
"flag"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
@@ -183,26 +181,21 @@ func TestCheckDeviceConnected(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCheckDeviceSigning_EnvAndKeyFile(t *testing.T) {
|
func TestCheckDeviceSigning_SurfacesSeamResult(t *testing.T) {
|
||||||
// The signing check defers to the driver's credential verification, which
|
// checkDeviceSigning is a passthrough to the driver's credential check; the
|
||||||
// reads the same environment a real build would.
|
// credential logic itself is covered by TestReadSigningCredentials* in the
|
||||||
for _, key := range []string{"SANDERLING_IOS_TEAM", "DEVELOPMENT_TEAM", "ASC_API_KEY_PATH", "ASC_API_KEY_ID", "ASC_API_ISSUER_ID"} {
|
// ioscompanion package. Here we only confirm the wiring through the seam.
|
||||||
t.Setenv(key, "")
|
original := doctorVerifySigning
|
||||||
}
|
t.Cleanup(func() { doctorVerifySigning = original })
|
||||||
if err := checkDeviceSigning(context.Background()); err == nil {
|
|
||||||
t.Fatal("missing signing env must fail")
|
doctorVerifySigning = func() error { return nil }
|
||||||
|
if err := checkDeviceSigning(context.Background()); err != nil {
|
||||||
|
t.Fatalf("a passing signing check must surface nil: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
keyPath := filepath.Join(t.TempDir(), "AuthKey.p8")
|
doctorVerifySigning = func() error { return errors.New("missing credentials") }
|
||||||
if err := os.WriteFile(keyPath, []byte("key"), 0o600); err != nil {
|
if err := checkDeviceSigning(context.Background()); err == nil {
|
||||||
t.Fatal(err)
|
t.Fatal("a failing signing check must surface the error")
|
||||||
}
|
|
||||||
t.Setenv("SANDERLING_IOS_TEAM", "TEAM1")
|
|
||||||
t.Setenv("ASC_API_KEY_ID", "KID")
|
|
||||||
t.Setenv("ASC_API_ISSUER_ID", "ISS")
|
|
||||||
t.Setenv("ASC_API_KEY_PATH", keyPath)
|
|
||||||
if err := checkDeviceSigning(context.Background()); err != nil {
|
|
||||||
t.Fatalf("complete signing env with a present key must pass: %v", err)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user