Documentation ¶
Index ¶
- Constants
- func AddToContext(r *http.Request, key, value interface{})
- func Auth(session SessionHandler) negroni.HandlerFunc
- func CaseProtocol(store CaseProtocolStore) negroni.HandlerFunc
- func Container(user UserRetriever, group GroupRetriever) negroni.HandlerFunc
- func Project(store ProjectStore) negroni.HandlerFunc
- func SequenceProtocol(store SequenceProtocolStore) negroni.HandlerFunc
- func TestSequence(store TestSequenceStore) negroni.HandlerFunc
- func Testcase(store TestCaseStore) negroni.HandlerFunc
- type CaseProtocolStore
- type GroupRetriever
- type ProjectStore
- type SequenceProtocolStore
- type SessionHandler
- type TestCaseStore
- type TestSequenceStore
- type UserRetriever
Constants ¶
const ContainerKey = "container"
ContainerKey is used to retrieve the container out of the request context. This can either be a user or a group.
const ProjectKey = "project"
ProjectKey is used to retrieve a project from a request context.
const ProtocolKey = "protocol"
const TestCaseKey = "testcase"
TestCaseKey is used to retrieve a testcase from a request context.
const TestSequenceKey = testSequenceKey("testsequence")
TestSequenceKey can be used to retrieve a testsequence from a request context.
const UserKey = "user"
UserKey is used to retrieve the currently signed in user from the request context (nil if no user is signed in).
Variables ¶
This section is empty.
Functions ¶
func AddToContext ¶
AddToContext adds a value to given request context.
func Auth ¶
func Auth(session SessionHandler) negroni.HandlerFunc
Auth returns a middleware that will check the user session for the signed in user. The retrieved user will be written into the request context with the key "user"
func CaseProtocol ¶ added in v1.4.0
func CaseProtocol(store CaseProtocolStore) negroni.HandlerFunc
CaseProtocol is a middleware that can retrieve a protocol from a request. It requires the container, the project and the testcase middleware to work.
func Container ¶
func Container(user UserRetriever, group GroupRetriever) negroni.HandlerFunc
Container returns a middleware that will get the container for a project from a request. For this to work
func Project ¶
func Project(store ProjectStore) negroni.HandlerFunc
Project returns a middleware that retrieves a project from a request and injects it into the request context. It requires the 'project' parameter containing the id of the project and the container middleware.
func SequenceProtocol ¶ added in v1.4.0
func SequenceProtocol(store SequenceProtocolStore) negroni.HandlerFunc
SequenceProtocol is a middleware that can retrieve a protocol from a request. It requires the container, the project and the testcase middleware to work.
func TestSequence ¶
func TestSequence(store TestSequenceStore) negroni.HandlerFunc
TestSequence is a middleware that can retrieve a testsequence from a request it requires the project as well as the container middleware to work.
func Testcase ¶
func Testcase(store TestCaseStore) negroni.HandlerFunc
Testcase is a middleware that can retrieve a testcase from a request it requires the project as well as the container middleware to work.
Types ¶
type CaseProtocolStore ¶ added in v1.4.0
type CaseProtocolStore interface { // GetCaseExecutionProtocols gets the protocols for the testcase with given id, // which is part of the project with given id. GetCaseExecutionProtocols(testcaseID id.TestID) ([]test.CaseExecutionProtocol, error) }
CaseProtocolStore provides an interface for retrieving both case and sequence protocols
type GroupRetriever ¶
type GroupRetriever interface { // Get returns the group with the given name Get(groupID id.ActorID) (*group.Group, bool, error) }
GroupRetriever is used to get a group by name.
type ProjectStore ¶
type ProjectStore interface { // Get looks up the project with the given id. It returns a pointer to the project and true // if a matching project was found or nil and false otherwise Get(projectID id.ProjectID) (*project.Project, bool, error) }
ProjectStore provides an interface for retrieving projects
type SequenceProtocolStore ¶ added in v1.4.0
type SequenceProtocolStore interface { // GetSequenceExecutionProtocols gets the protocols for the testsequence with given id, // which is part of the project with given id. GetSequenceExecutionProtocols(sequenceID id.TestID) ([]test.SequenceExecutionProtocol, error) }
SequenceProtocolStore provides an interface for retrieving sequence protocols
type SessionHandler ¶
type SessionHandler interface { // GetCurrent gets the user that hold the session. If there is no // user session the returned user will be nil. GetCurrent(r *http.Request) (*user.User, error) }
SessionHandler is used to get the user that corresponds to a request.
type TestCaseStore ¶
type TestCaseStore interface { // Get returns the test case with the given ID for the given project under the given container Get(caseID id.TestID) (*test.Case, bool, error) }
TestCaseStore provides an interface for retrieving testcases