summaryrefslogtreecommitdiff
path: root/bitmask_go/bonafide_test.go
blob: c40c98da87b9af955e028728c7cede4e8a087a5f (plain)
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
package bitmask

import (
	"bytes"
	"testing"
)

var (
	privateKeyHeader = []byte("-----BEGIN RSA PRIVATE KEY-----")
	certHeader       = []byte("-----BEGIN CERTIFICATE-----")
)

func TestGetCert(t *testing.T) {
	cert, err := getCertPem()
	if err != nil {
		t.Fatal("get_cert returned an error: ", err)
	}

	if !bytes.Contains(cert, privateKeyHeader) {
		t.Errorf("No private key present: \n%q", cert)
	}

	if !bytes.Equal(cert, certHeader) {
		t.Errorf("No cert present: \n%q", cert)
	}
}