Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ReviewTestcase ¶
type ReviewTestcase struct { Name string // Name of the testcase Match map[string]interface{} // Constraint's Match block Object func(t *testing.T) interface{} // function which returns an Object that's getting passed to the Review call WantMatch bool // true if the match should succeed WantConstraintError bool // true if adding the constraint should fail WantLogged *regexp.Regexp // regexp to check against logged messages // contains filtered or unexported fields }
ReviewTestcase exercises the TargetHandler's HandleReview and Library matching_constraints functions.
type TargetHandlerTest ¶
type TargetHandlerTest struct { // NewTargetHandler returns a new target handler. This should call t.Helper() // and t.Fatal() on any errors encountered during creation. NewTargetHandler func(t *testing.T) handler.TargetHandler // ReviewTestcases are the testcases that will be run against client.Review. ReviewTestcases []*ReviewTestcase }
TargetHandlerTest is a test harness for target handler
func CreateTargetHandler ¶
func CreateTargetHandler(t *testing.T, target handler.TargetHandler, tcs []*ReviewTestcase) *TargetHandlerTest
func (*TargetHandlerTest) Test ¶
func (tt *TargetHandlerTest) Test(t *testing.T)
Test runs all testcases in the TargetHandlerTest
Click to show internal directories.
Click to hide internal directories.