utils

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MockGinContextWithMultipartForm

func MockGinContextWithMultipartForm(form MultipartForm) (*gin.Context, error)

MockGinContextWithMultipartForm creates a mock gin.Context populated with the provided multipart form data. It constructs the multipart form, attaches it to a mock request, and creates a gin.Context using that request. Returns the created context and any error.

The request is a POST request to "/" with the provided form data.

func MockGinContextWithQueryParameters

func MockGinContextWithQueryParameters(parameters []QueryParameter) (*gin.Context, error)

MockGinContextWithQueryParameters creates a mock *gin.Context with the provided query parameters set. It is intended for use in tests.

It returns a GET request for the path "/"

Types

type Field

type Field struct {
	Name  string `yaml:"name"`
	Value string `yaml:"value"`
}

Field holds a key-value pair for a form field.

type File

type File struct {
	Name    string `yaml:"name"`
	Content string `yaml:"content"`
}

File contains metadata and content for a file in a multipart form.

type MultipartForm

type MultipartForm struct {
	Fields []Field           `yaml:"fields"` // Regular form fields
	Files  map[string][]File `yaml:"files"`  // File fields with file content
}

MultipartForm holds form fields and files for a multipart form.

type QueryParameter

type QueryParameter struct {
	Name  string `yaml:"name"`
	Value string `yaml:"value"`
}

QueryParameter holds a key-value pair for a query parameter.

type TestGlazedCommand

type TestGlazedCommand struct {
	// contains filtered or unexported fields
}

func NewTestGlazedCommand

func NewTestGlazedCommand(options ...cmds.CommandDescriptionOption) (*TestGlazedCommand, error)

func (*TestGlazedCommand) Description

func (t *TestGlazedCommand) Description() *cmds.CommandDescription

func (*TestGlazedCommand) RunIntoGlazeProcessor

func (t *TestGlazedCommand) RunIntoGlazeProcessor(
	ctx context.Context,
	parsedLayers *layers.ParsedLayers,
	gp middlewares.Processor,
) error

func (*TestGlazedCommand) ToYAML

func (t *TestGlazedCommand) ToYAML(w io.Writer) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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