e2etest

package
v0.76.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package e2etest contains some helpers to make external E2E tests using Telegram test server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EchoBot

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

EchoBot is a simple echo message bot.

func NewEchoBot

func NewEchoBot(suite *Suite, auth chan<- *tg.User) EchoBot

NewEchoBot creates new echo bot.

func (EchoBot) Run

func (b EchoBot) Run(ctx context.Context) error

Run setups and starts echo bot.

type Suite

type Suite struct {
	TB require.TestingT
	// contains filtered or unexported fields
}

Suite is struct which contains external E2E test parameters.

func NewSuite

func NewSuite(tb require.TestingT, config TestOptions) *Suite

NewSuite creates new Suite.

func (*Suite) Authenticate

func (s *Suite) Authenticate(ctx context.Context, client auth.FlowClient) error

Authenticate authenticates client on test server.

func (*Suite) Client

func (s *Suite) Client(logger *zap.Logger, handler telegram.UpdateHandler) *telegram.Client

Client creates new *telegram.Client using this suite.

func (*Suite) RetryAuthenticate added in v0.21.2

func (s *Suite) RetryAuthenticate(ctx context.Context, client auth.FlowClient) error

RetryAuthenticate authenticates client on test server.

type TestOptions added in v0.50.0

type TestOptions struct {
	AppID   int
	AppHash string
	DC      int
	Random  io.Reader
	Logger  *zap.Logger
}

TestOptions contains some common test server settings.

type User

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

User is a simple user bot.

func NewUser

func NewUser(suite *Suite, text []string, username string) User

NewUser creates new User bot.

func (User) Run

func (u User) Run(ctx context.Context) error

Run setups and starts user bot.

Jump to

Keyboard shortcuts

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