e2etest

package
v0.41.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package e2etest contains some helpers to make external E2E tests using Telegram staging 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 {
	tgtest.Suite
	TestConfig
	// contains filtered or unexported fields
}

Suite is struct which contains external E2E test parameters.

func NewSuite

func NewSuite(suite tgtest.Suite, config TestConfig, randomSource io.Reader) *Suite

NewSuite creates new Suite.

func (*Suite) Authenticate

func (s *Suite) Authenticate(ctx context.Context, client *telegram.Client) 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 *telegram.Client) error

RetryAuthenticate authenticates client on test server.

type TestConfig

type TestConfig struct {
	AppID   int
	AppHash string
	DC      int
}

TestConfig 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