test

package
v0.9.6 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2020 License: GPL-3.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BadBodyFile = qfs.NewMemfileBytes("bad_csv_file.csv", []byte(`
asdlkfasd,,
fm as
f;lajsmf 
a
's;f a'
sdlfj asdf`))

BadBodyFile is a bunch of bad CSV data

View Source
var BadDataFormatFile = qfs.NewMemfileBytes("abc.csv", []byte(`
"colA","colB","colC","colD"
1,2,3,4
1,2,3`))

BadDataFormatFile has weird line lengths

View Source
var BadStructureFile = qfs.NewMemfileBytes("badStructure.csv", []byte(`
colA, colB, colB, colC
1,2,3,4
1,2,3,4`))

BadStructureFile has double-named columns

Functions

func NewEmptyTestRepo added in v0.6.0

func NewEmptyTestRepo() (mr *repo.MemRepo, err error)

NewEmptyTestRepo initializes a test repo with no contents

func NewMemRepoFromDir added in v0.3.0

func NewMemRepoFromDir(path string) (repo.Repo, crypto.PrivKey, error)

NewMemRepoFromDir reads a director of testCases and calls createDataset on each case with the given privatekey, yeilding a repo where the peer with this pk has created each dataset in question

func NewTestCrypto added in v0.9.5

func NewTestCrypto() gen.CryptoGenerator

NewTestCrypto returns a mocked cryptographic generator for tests

func NewTestRepo

func NewTestRepo() (mr *repo.MemRepo, err error)

NewTestRepo generates a repository usable for testing purposes

func NewTestRepoFromProfileID added in v0.3.2

func NewTestRepoFromProfileID(id profile.ID, peerNum int, dataIndex int) (repo.Repo, error)

NewTestRepoFromProfileID constructs a repo from a profileID, usable for tests

func NewTestRepoWithHistory added in v0.8.0

func NewTestRepoWithHistory() (mr *repo.MemRepo, refs []reporef.DatasetRef, err error)

NewTestRepoWithHistory generates a repository with a dataset that has a history, usable for testing purposes

func ProfileConfig added in v0.3.0

func ProfileConfig() *config.ProfilePod

ProfileConfig returns the test profile as a config.Profile

func ReadRepoConfig added in v0.3.0

func ReadRepoConfig(path string) (pro *profile.Profile, pk crypto.PrivKey, err error)

ReadRepoConfig loads configuration data from a .yaml file

func TestdataPath added in v0.9.5

func TestdataPath(path string) string

TestdataPath returns the absolute path to a file in the testdata diretory

Types

type TempRepo added in v0.9.5

type TempRepo struct {
	RootPath   string
	IPFSPath   string
	QriPath    string
	TestCrypto gen.CryptoGenerator
	Streams    ioes.IOStreams

	UseMockRemoteClient bool
	// contains filtered or unexported fields
}

TempRepo manages a temporary repository for testing purposes, adding extra methods for testing convenience

func NewTempRepo added in v0.9.5

func NewTempRepo(peername, prefix string) (r TempRepo, err error)

NewTempRepo constructs the test repo and initializes everything as cheaply as possible. This function is non-deterministic. Each successive call to TempRepo will use different PKI credentials

func NewTempRepoFixedProfileID added in v0.9.5

func NewTempRepoFixedProfileID(peername, prefix string) (r TempRepo, err error)

NewTempRepoFixedProfileID creates a temp repo that always uses the same PKI credentials

func (*TempRepo) DatasetMarshalJSON added in v0.9.5

func (r *TempRepo) DatasetMarshalJSON(ref string) (string, error)

DatasetMarshalJSON reads the dataset head and marshals it as json.

func (*TempRepo) Delete added in v0.9.5

func (r *TempRepo) Delete()

Delete removes the test repo on disk.

func (*TempRepo) GetConfig added in v0.9.5

func (r *TempRepo) GetConfig() *config.Config

GetConfig returns the configuration for the test repo.

func (*TempRepo) GetOutput added in v0.9.5

func (r *TempRepo) GetOutput() string

GetOutput returns the output from the previously executed command.

func (*TempRepo) GetPathForDataset added in v0.9.5

func (r *TempRepo) GetPathForDataset(index int) (string, error)

GetPathForDataset returns the path to where the index'th dataset is stored on CAFS.

func (*TempRepo) ReadBodyFromIPFS added in v0.9.5

func (r *TempRepo) ReadBodyFromIPFS(keyPath string) (string, error)

ReadBodyFromIPFS reads the body of the dataset at the given keyPath stored in CAFS

func (*TempRepo) Repo added in v0.9.5

func (r *TempRepo) Repo() (repo.Repo, error)

Repo accesses the actual repo, building one if it doesn't already exist

func (*TempRepo) WriteConfigFile added in v0.9.5

func (r *TempRepo) WriteConfigFile() error

WriteConfigFile serializes the config file and writes it to the qri repository

Directories

Path Synopsis
Package spec contains a set of tests to ensure a repo implementation conforms to expected behaviors, calling RunRepoTests on a given repo implementation should pass all checks in order to properly work with Qri.
Package spec contains a set of tests to ensure a repo implementation conforms to expected behaviors, calling RunRepoTests on a given repo implementation should pass all checks in order to properly work with Qri.

Jump to

Keyboard shortcuts

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