aboutsummaryrefslogtreecommitdiff
path: root/instance_test.go
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus.dahlberg@kau.se>2020-11-17 20:27:53 +0100
committerRasmus Dahlberg <rasmus.dahlberg@kau.se>2020-11-17 20:27:53 +0100
commit8679d703aa3da8fe94246a4a31a563c0f763816e (patch)
tree5a80fff8a3b25ded65e75212d45f6bc62ada522e /instance_test.go
parent47423288b09826e454187ca3bb49ccaa3d6eaa13 (diff)
added test data
Diffstat (limited to 'instance_test.go')
-rw-r--r--instance_test.go37
1 files changed, 37 insertions, 0 deletions
diff --git a/instance_test.go b/instance_test.go
new file mode 100644
index 0000000..57dee82
--- /dev/null
+++ b/instance_test.go
@@ -0,0 +1,37 @@
+package stfe
+
+import (
+ "testing"
+
+ "crypto"
+ "crypto/x509"
+
+ "github.com/system-transparency/stfe/testdata"
+ "github.com/system-transparency/stfe/x509util"
+)
+
+func TestNewLogParameters(t *testing.T) {
+ makeTestLogParameters(t, nil)
+}
+
+func makeTestLogParameters(t *testing.T, signer crypto.Signer) *LogParameters {
+ anchorList, err := x509util.NewCertificateList(testdata.PemAnchors)
+ if err != nil {
+ t.Fatalf("must decode trust anchors: %v", err)
+ }
+ if got, want := len(anchorList), testdata.NumPemAnchors; got != want {
+ t.Fatalf("must have %d trust anchor(s), got %d", want, got)
+ }
+ return &LogParameters{
+ LogId: make([]byte, 32),
+ TreeId: 0,
+ Prefix: "/test",
+ MaxRange: 3,
+ MaxChain: 3,
+ AnchorPool: x509util.NewCertPool(anchorList),
+ AnchorList: anchorList,
+ KeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageAny},
+ Signer: signer,
+ HashType: crypto.SHA256,
+ }
+}