testutil

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package testutil provides shared test utilities for bluesnake tests. This includes HTTP test servers and common test data.

Index

Constants

This section is empty.

Variables

View Source
var (
	ServerIndexResponse = []byte("hello world\n")
	CallbackTestHTML    = []byte(`
<!DOCTYPE html>
<html>
<head>
<title>Callback Test Page</title>
</head>
<body>
<div id="firstElem">First</div>
<div id="secondElem">Second</div>
<div id="thirdElem">Third</div>
</body>
</html>
`)
	RobotsFile = `
User-agent: *
Allow: /allowed
Disallow: /disallowed
Disallow: /allowed*q=
`
)

Test data shared across tests

Functions

func NewTestServer

func NewTestServer() *httptest.Server

NewTestServer creates and starts a new HTTP test server

func NewUnstartedTestServer

func NewUnstartedTestServer() *httptest.Server

NewUnstartedTestServer creates an unstarted HTTP test server with all endpoints configured

func RequireSessionCookieAuthPage

func RequireSessionCookieAuthPage(handler http.Handler) http.Handler

RequireSessionCookieAuthPage is middleware that requires a session cookie, redirecting through an auth page to set it if not present

func RequireSessionCookieSimple

func RequireSessionCookieSimple(handler http.Handler) http.Handler

RequireSessionCookieSimple is middleware that requires a session cookie, redirecting to set it if not present

Types

This section is empty.

Jump to

Keyboard shortcuts

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