fixtures

package
v3.0.0-pre-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TestAppToken      = "xoxa-888888888888-888888888888-8888888888888-fffffffffffffffa915fe069d70a8ad81743b0ec4ee9c81540af43f5e143264b"
	TestBotToken      = "xoxb-888888888888-888888888888-8888888888888-fffffffffffffffa915fe069d70a8ad81743b0ec4ee9c81540af43f5e143264b"
	TestClientToken   = "xoxc-888888888888-888888888888-8888888888888-fffffffffffffffa915fe069d70a8ad81743b0ec4ee9c81540af43f5e143264b"
	TestExportToken   = "xoxe-888888888888-888888888888-8888888888888-fffffffffffffffa915fe069d70a8ad81743b0ec4ee9c81540af43f5e143264b"
	TestPersonalToken = "xoxp-777777777777-888888888888-8888888888888-fffffffffffffffa915fe069d70a8ad81743b0ec4ee9c81540af43f5e143264b"
)
View Source
const (
	SimpleMessageJSON = `` /* 778-byte string literal not displayed */

	ThreadMessage1JSON = `` /* 4735-byte string literal not displayed */

	ThreadedExportedMessage1JSON = `` /* 1626-byte string literal not displayed */

	BotMessageThreadParentJSON = `` /* 3083-byte string literal not displayed */

	BotMessageThreadChildJSON = `` /* 1873-byte string literal not displayed */

	TestChannelEveryoneMessagesNativeExport = `` /* 5078-byte string literal not displayed */

	AppMessageJSON = `` /* 776-byte string literal not displayed */

)
View Source
const ChunkFileChannelID = "CO73D19AAE17"
View Source
const (
	ChunkWorkspace = `` /* 170-byte string literal not displayed */
)
View Source
const FileJPEG = `` /* 2925-byte string literal not displayed */
View Source
const TestChannels = `` /* 4042-byte string literal not displayed */
View Source
const TestChannelsNativeExport = `` /* 3371-byte string literal not displayed */

TestChannelsNativeExport are from the real Slack workspace export.

View Source
const TestConversationExportJSON = `` /* 11394-byte string literal not displayed */
View Source
const TestConversationJSON = `` /* 7842-byte string literal not displayed */

TestConversationJSON channel: CHM82GF99

View Source
const TestMessage = `` /* 522-byte string literal not displayed */
View Source
const UsersJSON = `` /* 11818-byte string literal not displayed */

Variables

View Source
var (
	//go:embed assets/export/dms.json
	TestExpDMsJSON []byte

	//go:embed assets/export/mpims.json
	TestExpMPIMsJSON []byte

	//go:embed assets/export/groups.json
	TestExpGroupsJSON []byte

	//go:embed assets/export/channels.json
	TestExpChannelsJSON []byte

	//go:embed assets/export/users.json
	TestExpUsersJSON []byte

	//go:embed assets/export/ref-channels.json
	TestExpReferenceChannelsJSON []byte
)

Export fixtures.

View Source
var InCI = os.Getenv("CI") == "true"

InCI indicates whether the tests are running in CI.

View Source
var TestAuthTestInfo []byte
View Source
var TestExportFS embed.FS
View Source
var TestUsers = []slack.User{
	{ID: "LOL1", Name: "yippi", Deleted: false},
	{ID: "DELD", Name: "ka", Deleted: true},
	{ID: "LOL3", Name: "yay", IsRestricted: true},
	{ID: "LOL4", Name: "motherfucker", Deleted: false, IsBot: true},
}
View Source
var WorkspaceFiles = []string{"ora600.bin", "sdump.bin", "foo.bin", "bar.bin", "provider.bin", "default.bin"}

Functions

func ChunkFileJSONL

func ChunkFileJSONL() io.ReadSeeker

ChunkFileJSONL returns a reader for the chunks.jsonl.gz file.

func DebugTempDir

func DebugTempDir(t *testing.T) string

DebugTempDir creates a temporary directory for debugging purposes. It does not get removed after the test.

func DummyChannel

func DummyChannel(id string) *slack.Channel

DummyChannel is the helper function that returns a pointer to a slack.Channel with the given ID, that could be used in tests.

func FilledBuffer

func FilledBuffer(sz int) *bytes.Buffer

FilledBuffer returns buffer that filled with sz bytes of 0x00.

func FilledFile

func FilledFile(t *testing.T, sz int) *os.File

FilledFile returns a file that filled with sz bytes of 0x00.

func JoinPath

func JoinPath(dir string, files ...string) []string

JoinPath joins the dir to each file in files using filepath.Join.

func Load

func Load[T any](js string) T

Load loads a json data into T, or panics.

func LoadPtr

func LoadPtr[T any](js string) *T

LoadPtr loads a json data into *T, or panics.

func MkTestFile

func MkTestFile(t *testing.T, dir string, content string) string

MkTestFile creates a test file in the directory dir, and copies the content into it.

func MkTestFileName

func MkTestFileName(t *testing.T, path, content string) string

MkTestFileName creates a test file at the path, and copies the content into it.

func PrepareDir

func PrepareDir(t *testing.T, dir string, content string, files ...string)

PrepareDir creates a directory with test files.

func RandString

func RandString(sz int) string

func SkipInCI

func SkipInCI(t *testing.T)

func StripExt

func StripExt(filename string) string

StripExt strips file extension.

func TestAuthServer

func TestAuthServer(t *testing.T) *httptest.Server

TestAuthServer returns a test HTTP server that responds with the test auth info TestAuthTestInfo. The caller should close the server when done.

func TestServer

func TestServer(t *testing.T, code int, response []byte) *httptest.Server

TestServer returns a test HTTP server that responds with the given code and response. The caller should close the server when done.

Types

This section is empty.

Directories

Path Synopsis
Package fixchunks contains chunk fixtures.
Package fixchunks contains chunk fixtures.
Package fixgen generates test fixtures for slackdump.
Package fixgen generates test fixtures for slackdump.

Jump to

Keyboard shortcuts

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