testhelpers

package
v0.0.0-...-937b28e Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2022 License: GPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const InitMessages int = 4

Variables

View Source
var DefaultTransport = &http.Transport{
	Proxy: http.ProxyFromEnvironment,
	Dial: (&net.Dialer{
		Timeout:   5 * time.Second,
		KeepAlive: 5 * time.Second,
	}).Dial,
}

Functions

func CleanupDB

func CleanupDB()

func ConnectWS

func ConnectWS(client *http.Client) (*websocket.Conn, error)

func CreateLobby

func CreateLobby() *lobby.Lobby

func CreatePlayer

func CreatePlayer() *player.Player

func CreatePlayerAdmin

func CreatePlayerAdmin() *player.Player

func CreatePlayerMod

func CreatePlayerMod() *player.Player

func EmitJSONWithReply

func EmitJSONWithReply(conn *websocket.Conn, req map[string]interface{}) (map[string]interface{}, error)

func Login

func Login(steamid string, client *http.Client) (*http.Response, error)

func LoginAndConnectWS

func LoginAndConnectWS() (string, *websocket.Conn, *http.Client, error)

func NewClient

func NewClient() (client *http.Client)

func ReadJSON

func ReadJSON(conn *websocket.Conn) map[string]interface{}

func ReadMessages

func ReadMessages(conn *websocket.Conn, n int, t *testing.T) ([]map[string]interface{}, error)

func SocketCreateLobby

func SocketCreateLobby(conn *websocket.Conn)

Create lobby with id 1

func SocketJoinLobby

func SocketJoinLobby(conn *websocket.Conn)

Join lobby

func StartServer

func StartServer() *httptest.Server

Types

type SuffixList

type SuffixList struct{}

func (SuffixList) PublicSuffix

func (SuffixList) PublicSuffix(_ string) string

func (SuffixList) String

func (SuffixList) String() string

Jump to

Keyboard shortcuts

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