File: certificate_verify_test.go

package info (click to toggle)
golang-github-smallstep-cli 0.15.16%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 4,404 kB
  • sloc: sh: 512; makefile: 99
file content (33 lines) | stat: -rw-r--r-- 888 bytes parent folder | download | duplicates (2)
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
27
28
29
30
31
32
33
// +build integration

package integration

import (
	"fmt"
	"testing"
)

type CertificateVerifyCmd struct {
	name    string
	command CLICommand
	crt     string
	host    string
	roots   string
}

func (k CertificateVerifyCmd) fail(t *testing.T, expected string) {
	k.command.fail(t, k.name, expected, "")
}

func NewCertificateVerifyCmd(name, crt string) CertificateVerifyCmd {
	testdata := "testdata"
	crtFile := fmt.Sprintf("./%s/%s", testdata, crt)
	command := NewCLICommand().setCommand(fmt.Sprintf("step certificate verify %s",
		crtFile))
	return CertificateVerifyCmd{name: name, command: command, crt: crt}
}

func TestCertificateVerify(t *testing.T) {
	NewCertificateVerifyCmd("bad-pem", "bad-pem.crt").fail(t, "./testdata/bad-pem.crt contains an invalid PEM block\n")
	//NewKeypairCmd("success", "foo.csr", "intermediate_ca.crt", "intermediate_ca_key").setPass("pass").test(t)
}