Skip to content

Commit

Permalink
refactor: Rename printValidationResultHuman to printErrorPayloadHuman
Browse files Browse the repository at this point in the history
  • Loading branch information
zeisss committed Mar 8, 2024
1 parent c171860 commit 6168814
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cmd/testcase_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,6 @@ func runTestCaseCreate(cmd *cobra.Command, args []string) {
log.Fatal(err)
}

printValidationResultHuman(os.Stderr, success, errorMeta)
printErrorPayloadHuman(os.Stderr, success, errorMeta)
cmdExit(success)
}
2 changes: 1 addition & 1 deletion cmd/testcase_launch.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func MainTestRunLaunch(client *api.Client, testCaseSpec string, testRunLaunchOpt
log.Fatal(err)
}

printValidationResultHuman(os.Stderr, status, errorMeta)
printErrorPayloadHuman(os.Stderr, status, errorMeta)
cmdExit(status)
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/testcase_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func runTestCaseUpdate(cmd *cobra.Command, args []string) {
log.Fatal(err)
}

printValidationResultHuman(os.Stderr, success, errorMeta)
printErrorPayloadHuman(os.Stderr, success, errorMeta)
cmdExit(success)
}

Expand All @@ -106,7 +106,7 @@ func printValidationResultJSON(message string) {
fmt.Println(message)
}

func printValidationResultHuman(fp io.Writer, success bool, errorMeta api.ErrorPayload) {
func printErrorPayloadHuman(fp io.Writer, success bool, errorMeta api.ErrorPayload) {
prefix := "INFO"
if !success {
prefix = color.RedString("ERROR")
Expand Down
6 changes: 3 additions & 3 deletions cmd/testcase_update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import (

func TestPrintValidationResultHuman_NoErrors(t *testing.T) {
var buf strings.Builder
printValidationResultHuman(&buf, true, api.ErrorPayload{
printErrorPayloadHuman(&buf, true, api.ErrorPayload{
Message: "TestCase updated.",
})
assert.Equal(t, buf.String(), "INFO: TestCase updated.\n")
}

func TestPrintValidationResultHuman_ValidationErrors(t *testing.T) {
var buf strings.Builder
printValidationResultHuman(&buf, true, api.ErrorPayload{
printErrorPayloadHuman(&buf, true, api.ErrorPayload{
Message: "TestCase updated, but validation errors occured.",
Errors: []api.ErrorDetail{
{Code: "E0", Title: "Validation Error"},
Expand All @@ -29,7 +29,7 @@ func TestPrintValidationResultHuman_ValidationErrors(t *testing.T) {

func TestPrintValidationResultHuman_Error(t *testing.T) {
var buf strings.Builder
printValidationResultHuman(&buf, false, api.ErrorPayload{
printErrorPayloadHuman(&buf, false, api.ErrorPayload{
Message: "TestCase update failed.",
Errors: []api.ErrorDetail{
{Code: "E0", Title: "Error"},
Expand Down
2 changes: 1 addition & 1 deletion cmd/testcase_validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,6 @@ func runTestCaseValidateArg(cmd *cobra.Command, client *api.Client, fileOrStdin
return false, err
}

printValidationResultHuman(os.Stderr, success, errorMeta)
printErrorPayloadHuman(os.Stderr, success, errorMeta)
return success, nil
}

0 comments on commit 6168814

Please sign in to comment.