test

package
v1.4.5-alpha1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2019 License: MPL-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package test represents set of test writing helpers and global application tests. It provides a set of functions you can use for starting Ottemo application in a test mode, prepare randomized data, fill DB with sample data, which is use-full during GO tests writing.

Package also contains a set of benchmarks and tests which related to whole application rather when particular package. In order to run them use:

go test [-tags ...] github.com/ottemo/commerce/tests
go test -bench . [-tags ...] github.com/ottemo/commerce/tests

(refer to http://golang.org/pkg/testing/ for details)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRandomProductsToCart

func AddRandomProductsToCart(currentCheckout checkout.InterfaceCheckout, n int) error

AddRandomProductsToCart adds n count products to checkout cart

func CheckTestIniDefaults

func CheckTestIniDefaults() error

CheckTestIniDefaults prepares database to be used for tests

func FullCheckout

func FullCheckout() error

FullCheckout is a routine to emulate full checkout process at once

func GetNewCheckout

func GetNewCheckout(checkoutVisitor visitor.InterfaceVisitor) (checkout.InterfaceCheckout, error)

GetNewCheckout returns new checkout object with assigned new session, and cart to it

func GetRandomVisitor

func GetRandomVisitor() (visitor.InterfaceVisitor, error)

GetRandomVisitor returns visitor object with randomly filled data

func MakeSureProductsCount

func MakeSureProductsCount(countShouldBe int) error

MakeSureProductsCount checks products count in DB and adds missing if needed

func RandomizeShippingAndBillingAddresses

func RandomizeShippingAndBillingAddresses(currentCheckout checkout.InterfaceCheckout) error

RandomizeShippingAndBillingAddresses sets shipping and billing addresses for checkout object

func StartAppInTestingMode

func StartAppInTestingMode() error

StartAppInTestingMode starts application in "test mode" (you should use that function for your package test)

func SwitchToTestIniSection

func SwitchToTestIniSection() error

SwitchToTestIniSection switches ini config to use value from test section instead of general

func UpdateShippingAndPaymentMethods

func UpdateShippingAndPaymentMethods(currentCheckout checkout.InterfaceCheckout) error

UpdateShippingAndPaymentMethods sets check money order payment method and flat rate shipping method to checkout

func UpdateWorkingDirectory

func UpdateWorkingDirectory() error

UpdateWorkingDirectory modifies current working directory to be same for all packages

Types

This section is empty.

Jump to

Keyboard shortcuts

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