package test

import "github.com/zmap/zlint/v2/test"

Index

Functions

func ReadTestCert

func ReadTestCert(inPath string) *x509.Certificate

ReadTestCert loads a x509.Certificate from the given inPath which is assumed to be relative to `testdata/`.

Important: ReadTestCert is only appropriate for unit tests. It will panic if the inPath file can not be loaded.

func TestLint

func TestLint(lintName string, testCertFilename string) *lint.LintResult

TestLint executes the given lintName against a certificate read from a testcert data file with the given filename. Filenames should be relative to `testdata/` and not absolute file paths.

Important: TestLint is only appropriate for unit tests. It will panic if the lintName is not known or if the testCertFilename can not be loaded, or if the lint result is nil.

func TestLintCert

func TestLintCert(lintName string, cert *x509.Certificate) *lint.LintResult

TestLintCert executes a lint with the given name against an already parsed certificate. This is useful when a unit test reads a certificate from disk and then mutates it in some way before trying to lint it.

Important: TestLintCert is only appropriate for unit tests. It will panic if the lintName is not known or if the lint result is nil.

Source Files

helpers.go

Version
v2.2.1 (latest)
Published
Oct 9, 2020
Platform
linux/amd64
Imports
6 packages
Last checked
5 hours ago

Tools for package owners.