mock

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Copyright 2024 API Testing Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2024 API Testing Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2024 API Testing Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2024 API Testing Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DynamicServer

type DynamicServer interface {
	Start(reader Reader, prefix string) error
	SetupHandler(reader Reader, prefix string) (http.Handler, error)
	Stop() error
	GetPort() string
	Loadable
}

func NewInMemoryServer

func NewInMemoryServer(port int) DynamicServer

type Field

type Field struct {
	Name string `yaml:"name"`
	Kind string `yaml:"kind"`
}

type Item

type Item struct {
	Name     string   `yaml:"name"`
	Request  Request  `yaml:"request"`
	Response Response `yaml:"response"`
	Param    map[string]string
}

type Loadable

type Loadable interface {
	Load() error
}

type Object

type Object struct {
	Name      string  `yaml:"name"`
	InitCount *int    `yaml:"initCount"`
	Sample    string  `yaml:"sample"`
	Fields    []Field `yaml:"fields"`
}

type Reader

type Reader interface {
	Parse() (*Server, error)
	GetData() []byte
}

func NewLocalFileReader

func NewLocalFileReader(file string) Reader

type ReaderAndWriter

type ReaderAndWriter interface {
	Reader
	Writer
}

func NewInMemoryReader

func NewInMemoryReader(config string) ReaderAndWriter

type Request

type Request struct {
	Path   string            `yaml:"path"`
	Method string            `yaml:"method"`
	Header map[string]string `yaml:"header"`
	Body   string            `yaml:"body"`
}

type Response

type Response struct {
	Encoder    string            `yaml:"encoder"`
	Body       string            `yaml:"body"`
	Header     map[string]string `yaml:"header"`
	StatusCode int               `yaml:"statusCode"`
	BodyData   []byte
}

type Server

type Server struct {
	Objects  []Object  `yaml:"objects"`
	Items    []Item    `yaml:"items"`
	Webhooks []Webhook `yaml:"webhooks"`
}

type Webhook

type Webhook struct {
	Name    string  `yaml:"name"`
	Timer   string  `yaml:"timer"`
	Request Request `yaml:"request"`
}

type Writer

type Writer interface {
	Write([]byte)
}

Jump to

Keyboard shortcuts

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