package
0.0.0-20241212133632-bf86e9aaa01b
Repository: https://github.com/webdevfuel/projectmotor.git
Documentation: pkg.go.dev
# Functions
Body reads the body from the provided response and returns the string value.
Do makes a request with the default http client and returns the response.
Docs reads the body from the provided response and returns a goquery.Document.
FindByText returns a goquery.Selection with the provided selector, filtered by the provided text.
NewForm returns a Form.
NewRequest returns a http.Request build from provided TestRequest options.
NewServer returns a new handler.Handler and httptest.Server
Usually initialized before a set of requests as part of a test.
ResetAndSeedDB returns the first encountered error when dropping and creating all database tables.
SetUserSession returns a cookie with the format `_projectmotor_session=%s;` where %s is the session string with data about a user.
WithAuthentication returns a function that sets the authentication and cookie/session values on a TestRequest.
WithBody returns a function that sets the body on a TestRequest.
WithFormValues returns a function that sets the url values and content-type header as application/x-www-form-urlencoded on a TestRequest.
WithMethod returns a function that sets the method on a TestRequest.
WithUrl returns a function that sets the url on a TestRequest.
# Structs
A Field is a representation of multiple HTML elements commonly used in the web application, including a label, input and span (error).
A Form is a representation of a HTML form element, with a slice of fields.
FormValue is a representation of a key-value pair for test requests.
A Option is a representation of option HTML element.
A Select is a representation of select HTML element, including a label and span (error).
TestRequest is a representation of different options of a test request, used to build a http.Request from it.
# Type aliases
Method is a int representation of authentication states for tests (authenticated and unauthenticated).
Method is a int representation of HTTP methods, starting with Get at 0 and ending with Patch at 8.