socks

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2021 License: UPL-1.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Debug = pkg.Debug
	Info  = pkg.Info
	Error = pkg.Error
)

Constants for log levels

Variables

This section is empty.

Functions

This section is empty.

Types

type Cart

type Cart struct {
	Item []CartItem
}

Cart contains the items of a cart

type CartItem

type CartItem struct {
	ItemID    string  `json:"itemId"`
	Quantity  int     `json:"quantity"`
	UnitPrice float32 `json:"unitPrice"`
}

CartItem provides the details for an item in the cart

type Catalog

type Catalog struct {
	Item []CatalogItem
}

Catalog provides the contents of the catalog

type CatalogItem

type CatalogItem struct {
	Count       int      `json:"count"`
	Description string   `json:"description"`
	ID          string   `json:"id"`
	ImageURL    string   `json:"imageurl"`
	Name        string   `json:"name"`
	Price       float32  `json:"price"`
	Tag         []string `json:"tag"`
}

CatalogItem represents the information for an item in the catalog

type ID

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

ID is an id struct

type SockShop

type SockShop struct {
	Ingress string
	// contains filtered or unexported fields
}

SockShop encapsulates all testing information related to interactions with the sock shop app

func NewSockShop

func NewSockShop(username, password, ingress string) SockShop

NewSockShop creates a new sockshop instance

func (*SockShop) AddToCart

func (s *SockShop) AddToCart(item CatalogItem, hostname string) (*pkg.HTTPResponse, error)

AddToCart adds an item to the cart

func (*SockShop) ChangeAddress

func (s *SockShop) ChangeAddress(username string, hostname string) (*pkg.HTTPResponse, error)

ChangeAddress changes the address for the provided user

func (*SockShop) ChangePayment

func (s *SockShop) ChangePayment(hostname string) (*pkg.HTTPResponse, error)

ChangePayment changes the form of payment

func (*SockShop) CheckAddress added in v0.17.0

func (s *SockShop) CheckAddress(response *pkg.HTTPResponse, username string)

CheckAddress unmarshals the address from the HTTPResponse and validates that it is correctly formatted and contains the username

func (*SockShop) CheckCart

func (s *SockShop) CheckCart(cartItems []CartItem, item CatalogItem, quantity int)

CheckCart makes sure that the added item in the cart is present

func (*SockShop) Delete

func (s *SockShop) Delete(url string) (*pkg.HTTPResponse, error)

Delete is a wrapper function for HTTP request with cookies DELETE

func (*SockShop) DeleteCartItem added in v0.17.0

func (s *SockShop) DeleteCartItem(item CartItem, hostname string) (*pkg.HTTPResponse, error)

DeleteCartItems deletes all cart items

func (*SockShop) Get

func (s *SockShop) Get(url string) (*pkg.HTTPResponse, error)

Get is a wrapper function for HTTP request with cookies GET

func (*SockShop) GetCartItems

func (s *SockShop) GetCartItems(hostname string) (*pkg.HTTPResponse, error)

GetCartItems gathers all cart items

func (*SockShop) GetCatalogItems added in v0.17.0

func (s *SockShop) GetCatalogItems(hostname string) (*pkg.HTTPResponse, error)

GetCatalogItems retrieves the catalog items

func (*SockShop) GetHostHeader

func (s *SockShop) GetHostHeader() string

GetHostHeader returns the ingress host

func (*SockShop) GetOrders

func (s *SockShop) GetOrders(hostname string)

GetOrders retrieves the orders

func (*SockShop) Post

func (s *SockShop) Post(url, contentType string, body io.Reader) (*pkg.HTTPResponse, error)

Post is a wrapper function for HTTP request with cookies POST

func (*SockShop) RegisterUser

func (s *SockShop) RegisterUser(body string, hostname string) bool

RegisterUser interacts with sock shop to create a user

func (*SockShop) SetHostHeader

func (s *SockShop) SetHostHeader(host string)

SetHostHeader sets the ingress host

Jump to

Keyboard shortcuts

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