Skip to content

timokoenig/go-api-tester

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go API Tester

A simple helper that makes your life easier

Usage

package test

import (
    "testing"
    goapitester "github.com/timokoenig/go-api-tester"
)

func TestCreate(t *testing.T) {
    tester := goapitester.NewAPITester("<request-body>")
    tester.Authorize("<auth-token>")
    tester.Run(func(req *restful.Request, rsp *restful.Response) {
        sut := Calendar{}
        sut.Create(req, rsp)
    })
    tester.CompareBody(t, "<expected-response-body>")
    tester.CompareStatus(t, <expected-response-status>)
}

About

A simple go api test helper

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages