Documentation ¶
Overview ¶
Utility functions working with FreeCONF library
Index ¶
- Variables
- func AssertEqual(t Tester, a interface{}, b interface{}, msgs ...string) bool
- func DebugLog(e bool)
- func DebugLogEnabled() bool
- func Diff(t Tester, a []byte, b string) bool
- func DiffBytes(t Tester, a []byte, b []byte) bool
- func DiffFiles(t Tester, a string, b string) bool
- func Gold(t Tester, update bool, actual []byte, gfile string) bool
- func GoldFile(t Tester, update bool, actualFile string, gfile string) bool
- func HttpStatusCode(err error) int
- func MapValue(parent interface{}, key ...interface{}) interface{}
- func RequireEqual(t Tester, a interface{}, b interface{}, msgs ...string) bool
- type Tester
Constants ¶
This section is empty.
Variables ¶
var BadRequestError = errors.New("bad request")
BadRequestError is when end user is attempting to perform an operation that is invalid. When used with RESTCONF context, will result in 400 error.
var ConflictError = errors.New("conflict")
ConflictError is when multiple attempts to do something cannot be completed When used with RESTCONF context, will result in 409 error.
var Debug *log.Logger
Debug is discarded unless -debug flag is passed on CLI.
var Err *log.Logger
Err is for errors only. An error is somethhing that deserves immediate attention
var Info *log.Logger
Info is Warnings, or general information.
var NotFoundError = errors.New("not found")
NotFoundError is when a resource is not found. When used with RESTCONF context will result in 404 error
var NotImplementedError = errors.New("not implemented")
NotImplementedError is when something wasn't implemented and may be an optional part of the spec or a particular feature wasn't impemented When used with RESTCONF context, will result in 501 error.
UnauthorizedError when someone is attempting to do something they do not have access to
Functions ¶
func AssertEqual ¶
AssertEqual emits testing error if a and b are not equal. Returns true if equal
func DebugLogEnabled ¶
func DebugLogEnabled() bool
DebugLogEnabled returns whether debug level logging is on or not
func Diff ¶
Diff will compare byte array to file and emit formatted difference useful in "Golden File Testing", return true if no differences
func DiffBytes ¶
DiffBytes will compare two byte arrays and emit formatted difference useful in "Golden File Testing", return true if no differences
func DiffFiles ¶
DiffFiles will compare two files and emit formatted difference useful in "Golden File Testing", return true if no differences
func Gold ¶
Gold compares bytes to a the contents of a file on disk UNLESS update flag is passed, then it replaces contents of file on disk. This testing strategy if known as "gold files" and can be found in many projects including the Go SDK
func GoldFile ¶
Gold compares one file to a the contents of a file on disk UNLESS update flag is passed, then it replaces contents of file on disk. This testing strategy if known as "gold files" and can be found in many projects including the Go SDK
func HttpStatusCode ¶
HttpableError will see if error be converted to one of non-500 errors
func MapValue ¶
func MapValue(parent interface{}, key ...interface{}) interface{}
MapValue used in unit tests, not intended for use outsite this golang module so this function may be subject to change w/o warning
func RequireEqual ¶
RequireEqual is like AssertEqual except it aborts rest of test