chunktest

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: 14 Imported by: 0

Documentation

Overview

Package chunktest provides a test server for testing the chunk package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DirServer

type DirServer struct {
	// contains filtered or unexported fields
}

DirServer is a test server that serves files from a chunk.Directory.

func NewDirServer

func NewDirServer(cd *chunk.Directory) *DirServer

func (*DirServer) Close

func (s *DirServer) Close()

func (*DirServer) URL

func (s *DirServer) URL() string

URL returns the server URL.

type GetConversationRepliesResponse

type GetConversationRepliesResponse struct {
	slack.SlackResponse
	HasMore          bool             `json:"has_more"`
	ResponseMetaData responseMetaData `json:"response_metadata"`
	Messages         []slack.Message  `json:"messages"`
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is a test server for testing the chunk package, that serves API from a single chunk file.

func NewServer

func NewServer(rs io.ReadSeeker, currentUserID string) *Server

NewServer returns a new Server, it requires the chunk file handle in rs, and an ID of the user that will be returned by AuthTest in currentUserID.

func (*Server) URL

func (s *Server) URL() string

URL returns the server URL.

type TestAuth

type TestAuth struct {
	FakeToken            string
	FakeCookies          []*http.Cookie
	WantValidateError    error
	WantTestError        error
	WantHTTPClient       *http.Client
	WantHTTPClientErr    error
	WantAuthTestResponse *slack.AuthTestResponse
}

TestAuth to use with the chunktest server.

func (*TestAuth) Cookies

func (a *TestAuth) Cookies() []*http.Cookie

Cookies should return a set of Slack Session cookies.

func (*TestAuth) HTTPClient

func (a *TestAuth) HTTPClient() (*http.Client, error)

HTTPClient returns an authenticated HTTP client

func (*TestAuth) SlackToken

func (a *TestAuth) SlackToken() string

SlackToken should return the Slack Token value.

func (*TestAuth) Test

Test tests if credentials are valid.

func (*TestAuth) Validate

func (a *TestAuth) Validate() error

Validate should return error, in case the token or cookies cannot be retrieved.

Jump to

Keyboard shortcuts

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