mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-02-20 06:48:53 +02:00
This PR is part of #4767. It contains * add log to federation services * separat test package for test (fix dependency cycles) Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/10371 Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org> Co-authored-by: Michael Jerger <michael.jerger@meissa-gmbh.de> Co-committed-by: Michael Jerger <michael.jerger@meissa-gmbh.de>
24 lines
575 B
Go
24 lines
575 B
Go
// Copyright 2023, 2024 The Forgejo Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package forgefed_test
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"forgejo.org/modules/validation"
|
|
)
|
|
|
|
func validateAndCheckError(subject validation.Validateable, expectedError string) *string {
|
|
errors := subject.Validate()
|
|
err := errors[0]
|
|
if len(errors) < 1 {
|
|
val := "Validation error should have been returned, but was not."
|
|
return &val
|
|
} else if err != expectedError {
|
|
val := fmt.Sprintf("Validation error should be [%v] but was: %v\n", expectedError, err)
|
|
return &val
|
|
}
|
|
return nil
|
|
}
|