utils

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2015 License: MIT Imports: 8 Imported by: 0

README

go-utils

Utils library for Go

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LogLevel = struct {
	TRACE, DEBUG, INFO, WARN, ERROR, FATAL int
}{0, 1, 2, 3, 4, 5}

Log levels inspired in this list: https://github.com/NLog/NLog/wiki/Log-levels

Functions

func FailOnError

func FailOnError(t *testing.T, err error)

func Fixture

func Fixture(fn string) ([]byte, error)

This method implies that from the context where the test is being run a "fixtures" folder exists.

Types

type Logger

type Logger struct {
	Level int
	// contains filtered or unexported fields
}

func NewLogger

func NewLogger(facility io.Writer, level int) *Logger

func (*Logger) Debug

func (l *Logger) Debug(msg string, v ...interface{})

func (*Logger) Error

func (l *Logger) Error(msg string, v ...interface{})

func (*Logger) Fatal

func (l *Logger) Fatal(msg string, v ...interface{})

func (*Logger) Info

func (l *Logger) Info(msg string, v ...interface{})

func (*Logger) Print

func (l *Logger) Print(msg string, v ...interface{})

func (*Logger) Trace

func (l *Logger) Trace(msg string, v ...interface{})

func (*Logger) Warn

func (l *Logger) Warn(msg string, v ...interface{})

type StubHTTPClient

type StubHTTPClient struct {
	Expected     []byte // The payload that you expect to receive. This is to verify that your implementation is sending the proper payload to the server.
	Response     []byte // The response you want to return.
	ShouldVerify bool   // Make sure that the expected and the actual sent payload match.
	// contains filtered or unexported fields
}

func NewStubHTTPClient

func NewStubHTTPClient(t *testing.T) *StubHTTPClient

func (*StubHTTPClient) Post

func (s *StubHTTPClient) Post(uri, bodyType string, req io.Reader) (*http.Response, error)

func (*StubHTTPClient) Verify

func (s *StubHTTPClient) Verify()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL