testutil

package
v0.0.0-...-19239a5 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2021 License: EUPL-1.2 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TestPrivateKey = "" /* 1700-byte string literal not displayed */
	TestPublicKey  = "" /* 460-byte string literal not displayed */
)

Variables

This section is empty.

Functions

func CheckError

func CheckError(t *testing.T, response *httptest.ResponseRecorder, expectedCode int, msg string)

func CleanCache

func CleanCache(ctx context.Context, t *testing.T, cache *cache.Cache) func()

func CleanDb

func CleanDb(ctx goContext.Context, t *testing.T, connector *dbutil.Connector) func()

func CleanStorage

func CleanStorage(t *testing.T, storage *storage.LocalStorage) func()

func CreateDraft

func CreateDraft(ctx goContext.Context, t *testing.T, storage *storage.LocalStorage, cache *cache.Cache, userId int, name, data, id string) *entity.Draft

func CreateInvoice

func CreateInvoice(
	ctx goContext.Context, t *testing.T, connector *dbutil.Connector, id string, opts ...TestInvoiceOption,
) *entity.Invoice

func CreateToken

func CreateToken(ctx context.Context, t *testing.T, cache *cache.Cache, user *entity.User) string

func CreateUser

func CreateUser(ctx goContext.Context, t *testing.T, connector *dbutil.Connector, ico string) *entity.User

func ExecuteApiKeyRequest

func ExecuteApiKeyRequest(handler http.Handler, req *http.Request, token string) *httptest.ResponseRecorder

func ExecuteAuthRequest

func ExecuteAuthRequest(handler http.Handler, req *http.Request, authToken string) *httptest.ResponseRecorder

func ExecuteRequest

func ExecuteRequest(handler http.Handler, req *http.Request) *httptest.ResponseRecorder

func WithTest

func WithTest(invoice *entity.Invoice)

Types

type ErrorResponse

type ErrorResponse struct {
	Error string `json:"error"`
}

type TestInvoiceOption

type TestInvoiceOption = func(*entity.Invoice)

func WithAmount

func WithAmount(amount float64) TestInvoiceOption

func WithAmountCurrency

func WithAmountCurrency(currency string) TestInvoiceOption

func WithAmountWithoutVat

func WithAmountWithoutVat(amount float64) TestInvoiceOption

func WithAmountWithoutVatCurrency

func WithAmountWithoutVatCurrency(currency string) TestInvoiceOption

func WithCustomerIco

func WithCustomerIco(ico string) TestInvoiceOption

func WithCustomerName

func WithCustomerName(name string) TestInvoiceOption

func WithIssueDate

func WithIssueDate(date timeutil.Date) TestInvoiceOption

func WithSupplierIco

func WithSupplierIco(ico string) TestInvoiceOption

func WithSupplierName

func WithSupplierName(name string) TestInvoiceOption

Jump to

Keyboard shortcuts

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