New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

github.com/goapt/test

Package Overview
Dependencies
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/goapt/test

Source
Go Modules
Version
v1.0.1
Version published
Created
Source

Golang unit testing tools

Build Status codecov Go Report Card
GoDoc

go get github.com/goapt/test

HTTP Mock

var httpSuites = []test.HttpClientSuite{
    {
        URI: "/test",
        ResponseBody: `{"retcode":200}`,
    },
}

func TestLoginHandle(t *testing.T) {
	httpClient := test.NewHttpClientSuite(httpSuites)
    resp, err :=  httpClient.Post("https://dummy.impl/test",test.JsonContentType,strings.NewReader(""))
    assert.NoError(t, err)
    if err == nil {
        body, err := ioutil.ReadAll(resp.Body)
        assert.NoError(t, err)
        assert.Equal(t, `{"retcode":200}`, string(body))
    }
}

Redis memory server

Based on the github.com/alicebob/miniredis

rds := test.NewRedis()

Gee handler test

req := test.NewRequest("/test", func(c *gee.Context) gee.Response {
    return c.String("ok")
})

FAQs

Package last updated on 09 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts