mock

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Mock is a set of simulated database and bucket functions for unit testing.

Index

Constants

View Source
const (
	PrivateFile fs.FileMode = 0o600
	PrivateDir  fs.FileMode = 0o700

	SevenZip = "test/randomfiles.7z"
)

Variables

View Source
var (
	ErrBucket = errors.New("bucket already exists")
	ErrCreate = errors.New("create bucket")
)

Functions

func Bucket1

func Bucket1() string

Bucket1 returns the absolute path of bucket test 1.

func Bucket2

func Bucket2() string

Bucket2 returns the absolute path of bucket test 2.

func CreateItem

func CreateItem(bucket, file string, db *bolt.DB) error

CreateItem adds the bucket and the named file to the database.

func Export1

func Export1() string

Export1 returns the absolute path of export csv file 1.

func Item1

func Item1() string

Item1 returns the absolute path of test source file 1.

func Name

func Name() (string, error)

Name returns the absolute path of the mock Bolt database.

func Open

func Open() (*bolt.DB, error)

Open and return the mock database.

func Read

func Read(name string) (sum [32]byte, err error)

Read the named file and return its SHA256 checksum.

func RootDir

func RootDir() string

func TestOpen

func TestOpen() error

TestOpen creates and opens the mock database, the test 1 bucket and adds the source 1 file. The mock database is closed after the update. Note: If this test fails under Windows, try running `go test ./...` after closing VS Code. https://github.com/electron-userland/electron-builder/issues/3666

func TestRemove

func TestRemove() error

TestRemove deletes the mock database.

Types

This section is empty.

Jump to

Keyboard shortcuts

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