kittest

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2017 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// FixturesPath is the path that any files make during testing will be put under
	FixturesPath = filepath.Join(".", "fixtures")
	// FixtureProjectPath is a directory where any projects files will be put
	FixtureProjectPath = filepath.Join(FixturesPath, "project")
	// UpdateFilePath is the file for testing updating themekit
	UpdateFilePath = filepath.Join(FixturesPath, "updateme")
	// NewUpdateFile is the file that is sent for updating themekit
	NewUpdateFile = []byte{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}
	// NewUpdateFileChecksum is the checksum for newupdatefile
	NewUpdateFileChecksum = md5.Sum(NewUpdateFile)
)
View Source
var ProjectFiles = []string{
	filepath.Join("assets", "application.js"),
	filepath.Join("assets", "pixel.png"),
	filepath.Join("config", "settings_data.json"),
	filepath.Join("layout", ".gitkeep"),
	filepath.Join("locales", "en.json"),
	filepath.Join("snippets", "snippet.js"),
	filepath.Join("templates", "template.liquid"),
	filepath.Join("templates", "customers", "test.liquid"),
}

ProjectFiles are the files that are generated for project fixtures

View Source
var (

	// ReleaseAtom is a atom release for testing release selection
	ReleaseAtom, _ = atom.LoadFeed(strings.NewReader(releaseAtom))
)
View Source
var SymlinkProjectPath = filepath.Join(FixturesPath, "sym_project")

SymlinkProjectPath is the path the the symlink to test project symlinks

Functions

func Cleanup

func Cleanup()

Cleanup should be called after any test that touches the fs

func GenerateBadMultiConfig

func GenerateBadMultiConfig(domain string) error

GenerateBadMultiConfig will generate a config using the passed domain with proxy config, but with one invalid environment

func GenerateConfig

func GenerateConfig(domain string, valid bool) error

GenerateConfig will generate a config using the passed domain. To test invalid config pass false to valid.

func GenerateJSONConfig

func GenerateJSONConfig(domain string) error

GenerateJSONConfig will generate and write a valid json config for testing

func GenerateProject

func GenerateProject() error

GenerateProject will generate a fake project of fixtures for testing

func GenerateProxyConfig

func GenerateProxyConfig(domain string) error

GenerateProxyConfig will generate a config using the passed domain with proxy config.

func Setup

func Setup()

Setup will generate all the project files and directories needed for testing kit and cmd

func TouchFixtureFile

func TouchFixtureFile(path, content string) error

TouchFixtureFile will create a fixture in the fixture project path.

Types

type Server

type Server struct {
	*httptest.Server
	Requests []*http.Request
	// contains filtered or unexported fields
}

Server is a test server that will record requests and server shopify responses

func NewTestServer

func NewTestServer() *Server

NewTestServer is test server setup to act like the shopify API so that we can test against it for different responses

func (*Server) Reset

func (server *Server) Reset()

Reset will reset the request log

func (*Server) ServeHTTP

func (server *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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