Documentation ¶
Index ¶
- Constants
- type Cart
- type CartItem
- type Catalog
- type CatalogItem
- type ID
- type SockShop
- func (s *SockShop) AddToCart(item CatalogItem, hostname string) (*pkg.HTTPResponse, error)
- func (s *SockShop) ChangeAddress(username string, hostname string) (*pkg.HTTPResponse, error)
- func (s *SockShop) ChangePayment(hostname string) (*pkg.HTTPResponse, error)
- func (s *SockShop) CheckAddress(response *pkg.HTTPResponse, username string)
- func (s *SockShop) CheckCart(cartItems []CartItem, item CatalogItem, quantity int)
- func (s *SockShop) Delete(url string) (*pkg.HTTPResponse, error)
- func (s *SockShop) DeleteCartItem(item CartItem, hostname string) (*pkg.HTTPResponse, error)
- func (s *SockShop) Get(url string) (*pkg.HTTPResponse, error)
- func (s *SockShop) GetCartItems(hostname string) (*pkg.HTTPResponse, error)
- func (s *SockShop) GetCatalogItems(hostname string) (*pkg.HTTPResponse, error)
- func (s *SockShop) GetHostHeader() string
- func (s *SockShop) GetOrders(hostname string)
- func (s *SockShop) Post(url, contentType string, body io.Reader) (*pkg.HTTPResponse, error)
- func (s *SockShop) RegisterUser(body string, hostname string) bool
- func (s *SockShop) SetHostHeader(host string)
Constants ¶
Constants for log levels
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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 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 ¶
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 ¶
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
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 ¶
GetHostHeader returns the ingress host
func (*SockShop) RegisterUser ¶
RegisterUser interacts with sock shop to create a user
func (*SockShop) SetHostHeader ¶
SetHostHeader sets the ingress host