refactor: IStep interface

This commit is contained in:
debugtalk
2021-09-22 18:41:28 +08:00
parent 57a1daf105
commit fe6cca362c
6 changed files with 41 additions and 19 deletions

View File

@@ -1,9 +1,11 @@
package httpboomer
import "fmt"
// implements IStep interface
type stepRequestValidation struct {
runner *Runner
TStep *TStep
step *TStep
}
func (s *stepRequestValidation) AssertEqual(jmesPath string, expected interface{}, msg string) *stepRequestValidation {
@@ -13,14 +15,18 @@ func (s *stepRequestValidation) AssertEqual(jmesPath string, expected interface{
Expect: expected,
Message: msg,
}
s.TStep.Validators = append(s.TStep.Validators, validator)
s.step.Validators = append(s.step.Validators, validator)
return s
}
func (s *stepRequestValidation) ToStruct() *TStep {
return s.TStep
func (s *stepRequestValidation) Name() string {
return s.step.Name
}
func (s *stepRequestValidation) Type() string {
return fmt.Sprintf("request-%v", s.step.Request.Method)
}
func (s *stepRequestValidation) Run() error {
return s.runner.runStep(s.TStep)
return s.runner.runStep(s.step)
}