socks

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2021 License: UPL-1.0 Imports: 10 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 {
	Cookies []*http.Cookie
	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) AccessPath

func (s *SockShop) AccessPath(path, expectedString string, hostname string)

AccessPath ensures the given path is accessible

func (*SockShop) AddToCart

func (s *SockShop) AddToCart(item CatalogItem, hostname string)

AddToCart adds an item to the cart

func (*SockShop) ChangeAddress

func (s *SockShop) ChangeAddress(username string, hostname string)

ChangeAddress changes the address for the provided user

func (*SockShop) ChangePayment

func (s *SockShop) ChangePayment(hostname string)

ChangePayment changes the form of payment

func (*SockShop) CheckCart

func (s *SockShop) CheckCart(item CatalogItem, quantity int, hostname string)

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

func (*SockShop) CheckCartEmpty

func (s *SockShop) CheckCartEmpty(hostname string)

CheckCartEmpty checks whether the cart has no items

func (*SockShop) ConnectToCatalog

func (s *SockShop) ConnectToCatalog(hostname string) string

ConnectToCatalog connects to the catalog page

func (*SockShop) Delete

func (s *SockShop) Delete(url string) (int, string)

Delete is a wrapper function for HTTP request with cookies DELETE

func (*SockShop) DeleteCartItems

func (s *SockShop) DeleteCartItems(items []CartItem, hostname string)

DeleteCartItems deletes all cart items

func (*SockShop) Get

func (s *SockShop) Get(url string) (int, string)

Get is a wrapper function for HTTP request with cookies GET

func (*SockShop) GetCartItems

func (s *SockShop) GetCartItems(hostname string) []CartItem

GetCartItems gathers all cart items

func (*SockShop) GetCatalogItem

func (s *SockShop) GetCatalogItem(hostname string) Catalog

GetCatalogItem retrieves the first catalog item

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) (int, string)

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

func (*SockShop) VerifyCatalogItems

func (s *SockShop) VerifyCatalogItems(webpage string)

VerifyCatalogItems gets catalog items and accesses detail page

Jump to

Keyboard shortcuts

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