| 1 |
|
| 2 |
|
| 3 |
package integration |
| 4 |
|
| 5 |
import ( |
| 6 |
"fmt" |
| 7 |
"testing" |
| 8 |
) |
| 9 |
|
| 10 |
type CertificateVerifyCmd struct { |
| 11 |
name string |
| 12 |
command CLICommand |
| 13 |
crt string |
| 14 |
host string |
| 15 |
roots string |
| 16 |
} |
| 17 |
|
| 18 |
func (k CertificateVerifyCmd) fail(t *testing.T, expected string) { |
| 19 |
k.command.fail(t, k.name, expected, "") |
| 20 |
} |
| 21 |
|
| 22 |
func NewCertificateVerifyCmd(name, crt string) CertificateVerifyCmd { |
| 23 |
testdata := "testdata" |
| 24 |
crtFile := fmt.Sprintf("./%s/%s", testdata, crt) |
| 25 |
command := NewCLICommand().setCommand(fmt.Sprintf("step certificate verify %s", |
| 26 |
crtFile)) |
| 27 |
return CertificateVerifyCmd{name: name, command: command, crt: crt} |
| 28 |
} |
| 29 |
|
| 30 |
func TestCertificateVerify(t *testing.T) { |
| 31 |
NewCertificateVerifyCmd("bad-pem", "bad-pem.crt").fail(t, "./testdata/bad-pem.crt contains an invalid PEM block\n") |
| 32 |
|
| 33 |
} |