Documentation ¶
Index ¶
- Constants
- func AddToContext(r *http.Request, key, value interface{})
- func Auth(session SessionHandler) negroni.HandlerFunc
- func Comments(store CommentStore, isCase bool) negroni.HandlerFunc
- func Container(user UserRetriever, group GroupRetriever) negroni.HandlerFunc
- func Project(store ProjectStore) negroni.HandlerFunc
- func TestSequence(store TestSequenceStore) negroni.HandlerFunc
- func Testcase(store TestCaseStore) negroni.HandlerFunc
- type CommentStore
- type GroupRetriever
- type ProjectStore
- type SessionHandler
- type TestCaseStore
- type TestSequenceStore
- type TestSequenceStoreMock
- type UserRetriever
Constants ¶
const CommentsKey = "Comments"
CommentsKey is used to retrieve comments from a request context.
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 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 Comments ¶ added in v0.10.0
func Comments(store CommentStore, isCase bool) negroni.HandlerFunc
Comments is a middleware that can retrieve the comments from a request it requires the project as well as the container 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 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 CommentStore ¶ added in v0.10.0
type CommentStore interface { // Get returns the comments for the test case or test sequence // with the given ID for the given project under the given container Get(id id.TestID) ([]*comment.Comment, bool) }
CommentStore provides an interface for retrieving comments
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 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
type TestSequenceStore ¶
type TestSequenceStore interface { // Get returns the test case with the given ID for the given project under the given container Get(sequenceID id.TestID) (*test.Sequence, bool, error) }
TestSequenceStore provides an interface for retrieving sequence