starrtest

package
v0.0.0-...-f30bd74 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package starrtest provides methods that are shared by all the tests in the other sub packages.

Index

Constants

View Source
const (
	// Error body for 401 response.
	BodyUnauthorized = `{"error": "Unauthorized"}`
	// Error body for 404 response.
	BodyNotFound = `{"message": "NotFound"}`
	// Error body for 405 response.
	BodyMethodNotAllowed = `{"message": "MethodNotAllowed"}`
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MockData

type MockData struct {
	// A name for the test.
	Name string
	// The path expected in the request ie. /api/v1/thing
	ExpectedPath string
	// The request body (json) expected from the caller.
	ExpectedRequest string
	// The request method (GET/POST) expected from the caller.
	ExpectedMethod string
	// This is the status that gets returned the caller.
	ResponseStatus int
	// The (json) response body returned to caller.
	ResponseBody string
	// Caller's request.
	WithRequest interface{}
	// Caller's response.
	WithResponse interface{}
	// Caller's response.
	WithError error
}

MockData allows generic testing of http inputs and outputs. This is used by the submodule tests.

func (*MockData) GetMockServer

func (test *MockData) GetMockServer(t *testing.T) *httptest.Server

GetMockServer is used in all the submodule http tests.

Jump to

Keyboard shortcuts

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