e2etest

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2020 License: MIT Imports: 10 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.

type TestConfig

type TestConfig struct {
	AppID   int
	AppHash string
	DcID    int
	Addr    string
}

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, botID *tg.User) 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