Replace godep with dep

This commit is contained in:
Manuel de Brito Fontes 2017-10-06 17:26:14 -03:00
parent 1e7489927c
commit bf5616c65b
14883 changed files with 3937406 additions and 361781 deletions

View file

@ -0,0 +1,33 @@
package certUtil
import (
"crypto/x509"
"testing"
"os"
"io/ioutil"
"github.com/stretchr/testify/assert"
)
func TestFetchCertificateChain(t *testing.T) {
file, err := os.Open("../tests/comodo.der.crt")
if err != nil {
t.Error(err)
}
data, err := ioutil.ReadAll(file)
if err != nil {
t.Error(err)
}
cert, err := x509.ParseCertificate(data)
if err != nil {
t.Error(err)
}
certs, err := FetchCertificateChain(cert)
if err != nil {
t.Error(err)
}
assert.Equal(t, 3, len(certs))
}

View file

@ -0,0 +1,11 @@
package certUtil
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestIsPEM(t *testing.T) {
assert.True(t, IsPEM([]byte("-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----")))
assert.False(t, IsPEM([]byte("xxx")))
}