Documentation
¶
Overview ¶
Package contracts provides API contract definitions for integration testing.
Index ¶
- Variables
- func RegisterArticleContracts()
- func RegisterQueuePriorityContracts()
- func RegisterSearchContracts()
- func RegisterStateSLAContracts()
- func ValidateSchema(actual interface{}, expected interface{}) error
- type ArraySchema
- type BooleanSchema
- type Contract
- type ContractTest
- type MockHandlers
- func (m *MockHandlers) HandleAddUserToGroup(c *gin.Context)
- func (m *MockHandlers) HandleAssignTicket(c *gin.Context)
- func (m *MockHandlers) HandleCloseTicket(c *gin.Context)
- func (m *MockHandlers) HandleCreateTicket(c *gin.Context)
- func (m *MockHandlers) HandleCreateUser(c *gin.Context)
- func (m *MockHandlers) HandleDeleteTicket(c *gin.Context)
- func (m *MockHandlers) HandleDeleteUser(c *gin.Context)
- func (m *MockHandlers) HandleGetTicket(c *gin.Context)
- func (m *MockHandlers) HandleGetUser(c *gin.Context)
- func (m *MockHandlers) HandleGetUserGroups(c *gin.Context)
- func (m *MockHandlers) HandleListTickets(c *gin.Context)
- func (m *MockHandlers) HandleListUsers(c *gin.Context)
- func (m *MockHandlers) HandleLogin(c *gin.Context)
- func (m *MockHandlers) HandleLogout(c *gin.Context)
- func (m *MockHandlers) HandleRefresh(c *gin.Context)
- func (m *MockHandlers) HandleRemoveUserFromGroup(c *gin.Context)
- func (m *MockHandlers) HandleReopenTicket(c *gin.Context)
- func (m *MockHandlers) HandleUpdateTicket(c *gin.Context)
- func (m *MockHandlers) HandleUpdateUser(c *gin.Context)
- type NumberSchema
- type ObjectSchema
- type Response
- type Schema
- type StringSchema
- type Validation
Constants ¶
This section is empty.
Variables ¶
var ArticleContracts = []Contract{ { Name: "ListArticles", Description: "List all articles for a ticket", Method: "GET", Path: "/api/v1/tickets/1/articles", Headers: map[string]string{ "Authorization": "Bearer {{token}}", }, Expected: Response{ Status: http.StatusOK, BodySchema: ObjectSchema{ Required: true, Properties: map[string]Schema{ "articles": ArraySchema{ItemsSchema: ObjectSchema{Properties: map[string]Schema{ "id": NumberSchema{Required: true}, "ticket_id": NumberSchema{Required: true}, "subject": StringSchema{}, "body": StringSchema{}, }}}, "total": NumberSchema{}, }, }, }, }, { Name: "GetArticle", Description: "Get single article by ID", Method: "GET", Path: "/api/v1/tickets/1/articles/1", Headers: map[string]string{ "Authorization": "Bearer {{token}}", }, Expected: Response{ Status: http.StatusOK, BodySchema: ObjectSchema{Required: true, Properties: map[string]Schema{ "id": NumberSchema{Required: true}, "ticket_id": NumberSchema{Required: true}, "subject": StringSchema{}, "body": StringSchema{}, }}, }, }, { Name: "GetArticleWithAttachments", Description: "Get article with attachment information", Method: "GET", Path: "/api/v1/tickets/1/articles/1?include_attachments=true", Headers: map[string]string{ "Authorization": "Bearer {{token}}", }, Expected: Response{ Status: http.StatusOK, BodySchema: ObjectSchema{Required: true, Properties: map[string]Schema{ "id": NumberSchema{Required: true}, "ticket_id": NumberSchema{Required: true}, "subject": StringSchema{}, "body": StringSchema{}, "attachments": ArraySchema{ItemsSchema: ObjectSchema{Properties: map[string]Schema{ "id": NumberSchema{Required: true}, "filename": StringSchema{Required: true}, "content_type": StringSchema{}, "size": NumberSchema{}, }}}}, }, }, }, { Name: "CreateArticle", Description: "Create new article for ticket", Method: "POST", Path: "/api/v1/tickets/1/articles", Headers: map[string]string{ "Authorization": "Bearer {{token}}", "Content-Type": "application/json", }, Body: map[string]interface{}{ "subject": "Test Article", "body": "This is a test article body", "from_email": "agent@example.com", "to_email": "customer@example.com", "article_type": "email-external", "sender_type": "agent", "is_visible": true, }, Expected: Response{ Status: http.StatusCreated, BodySchema: ObjectSchema{Required: true, Properties: map[string]Schema{ "id": NumberSchema{Required: true}, "ticket_id": NumberSchema{Required: true}, "subject": StringSchema{}, "body": StringSchema{}, }}, }, }, { Name: "UpdateArticle", Description: "Update existing article", Method: "PUT", Path: "/api/v1/tickets/1/articles/1", Headers: map[string]string{ "Authorization": "Bearer {{token}}", "Content-Type": "application/json", }, Body: map[string]interface{}{ "subject": "Updated Article Subject", "body": "Updated article body content", }, Expected: Response{ Status: http.StatusOK, BodySchema: ObjectSchema{Required: true, Properties: map[string]Schema{ "id": NumberSchema{Required: true}, "ticket_id": NumberSchema{Required: true}, "subject": StringSchema{}, "body": StringSchema{}, }}, }, }, { Name: "DeleteArticle", Description: "Delete article from ticket", Method: "DELETE", Path: "/api/v1/tickets/1/articles/2", Headers: map[string]string{ "Authorization": "Bearer {{token}}", }, Expected: Response{ Status: http.StatusOK, BodySchema: ObjectSchema{Required: true, Properties: map[string]Schema{ "message": StringSchema{}, "id": NumberSchema{}, }}, }, }, }
ArticleContracts defines the API contracts for article endpoints.
var PriorityContracts = []Contract{ { Name: "ListPriorities", Description: "List all priorities", Method: "GET", Path: "/api/v1/priorities", Headers: map[string]string{ "Authorization": "Bearer {{token}}", }, Expected: Response{ Status: http.StatusOK, BodySchema: ObjectSchema{Required: true, Properties: map[string]Schema{ "priorities": ArraySchema{ItemsSchema: ObjectSchema{Properties: map[string]Schema{ "id": NumberSchema{Required: true}, "name": StringSchema{Required: true}, "valid_id": NumberSchema{}, }}, Required: true}, "total": NumberSchema{}, }}, }, }, { Name: "GetPriority", Description: "Get single priority by ID", Method: "GET", Path: "/api/v1/priorities/1", Headers: map[string]string{ "Authorization": "Bearer {{token}}", }, Expected: Response{ Status: http.StatusOK, BodySchema: ObjectSchema{Required: true, Properties: map[string]Schema{ "id": NumberSchema{Required: true}, "name": StringSchema{Required: true}, "valid_id": NumberSchema{}, }}, }, }, { Name: "CreatePriority", Description: "Create new priority", Method: "POST", Path: "/api/v1/priorities", Headers: map[string]string{ "Authorization": "Bearer {{token}}", "Content-Type": "application/json", }, Body: map[string]interface{}{ "name": "Test Priority", }, Expected: Response{ Status: http.StatusCreated, BodySchema: ObjectSchema{Required: true, Properties: map[string]Schema{ "id": NumberSchema{Required: true}, "name": StringSchema{Required: true}, "valid_id": NumberSchema{}, }}, }, }, { Name: "UpdatePriority", Description: "Update existing priority", Method: "PUT", Path: "/api/v1/priorities/6", Headers: map[string]string{ "Authorization": "Bearer {{token}}", "Content-Type": "application/json", }, Body: map[string]interface{}{ "name": "Updated Priority", }, Expected: Response{ Status: http.StatusOK, BodySchema: ObjectSchema{Required: true, Properties: map[string]Schema{ "id": NumberSchema{Required: true}, "name": StringSchema{Required: true}, "valid_id": NumberSchema{}, }}, }, }, { Name: "DeletePriority", Description: "Soft delete priority", Method: "DELETE", Path: "/api/v1/priorities/10", Headers: map[string]string{ "Authorization": "Bearer {{token}}", }, Expected: Response{ Status: http.StatusOK, BodySchema: ObjectSchema{Required: true, Properties: map[string]Schema{ "message": StringSchema{}, "id": NumberSchema{}, }}, }, }, }
PriorityContracts defines the API contracts for priority endpoints.
var QueueContracts = []Contract{ { Name: "ListQueues", Description: "List all queues", Method: "GET", Path: "/api/v1/queues", Headers: map[string]string{ "Authorization": "Bearer {{token}}", }, Expected: Response{ Status: http.StatusOK, BodySchema: ObjectSchema{Required: true, Properties: map[string]Schema{ "queues": ArraySchema{ItemsSchema: ObjectSchema{Properties: map[string]Schema{ "id": NumberSchema{Required: true}, "name": StringSchema{Required: true}, "description": StringSchema{}, "valid_id": NumberSchema{}, }}, Required: true}, "total": NumberSchema{}, }}, }, }, { Name: "GetQueue", Description: "Get single queue by ID", Method: "GET", Path: "/api/v1/queues/1", Headers: map[string]string{ "Authorization": "Bearer {{token}}", }, Expected: Response{ Status: http.StatusOK, BodySchema: ObjectSchema{Required: true, Properties: map[string]Schema{ "id": NumberSchema{Required: true}, "name": StringSchema{Required: true}, "description": StringSchema{}, "valid_id": NumberSchema{}, }}, }, }, { Name: "CreateQueue", Description: "Create new queue", Method: "POST", Path: "/api/v1/queues", Headers: map[string]string{ "Authorization": "Bearer {{token}}", "Content-Type": "application/json", }, Body: map[string]interface{}{ "name": "Test Queue", "description": "Test queue description", "group_access": []int{1, 2}, }, Expected: Response{ Status: http.StatusCreated, BodySchema: ObjectSchema{Required: true, Properties: map[string]Schema{ "id": NumberSchema{Required: true}, "name": StringSchema{Required: true}, "description": StringSchema{}, "valid_id": NumberSchema{}, }}, }, }, { Name: "UpdateQueue", Description: "Update existing queue", Method: "PUT", Path: "/api/v1/queues/1", Headers: map[string]string{ "Authorization": "Bearer {{token}}", "Content-Type": "application/json", }, Body: map[string]interface{}{ "name": "Updated Queue", "description": "Updated description", }, Expected: Response{ Status: http.StatusOK, BodySchema: ObjectSchema{Required: true, Properties: map[string]Schema{ "id": NumberSchema{Required: true}, "name": StringSchema{Required: true}, "description": StringSchema{}, "valid_id": NumberSchema{}, }}, }, }, { Name: "DeleteQueue", Description: "Soft delete queue", Method: "DELETE", Path: "/api/v1/queues/10", Headers: map[string]string{ "Authorization": "Bearer {{token}}", }, Expected: Response{ Status: http.StatusOK, BodySchema: ObjectSchema{Required: true, Properties: map[string]Schema{ "message": StringSchema{}, "id": NumberSchema{}, }}, }, }, }
QueueContracts defines the API contracts for queue endpoints.
var SLAContracts = []Contract{ { Name: "ListSLAs", Description: "List all SLAs", Method: "GET", Path: "/api/v1/slas", Headers: map[string]string{ "Authorization": "Bearer {{token}}", }, Expected: Response{ Status: http.StatusOK, BodySchema: ObjectSchema{Required: true, Properties: map[string]Schema{ "slas": ArraySchema{ItemsSchema: ObjectSchema{Properties: map[string]Schema{ "id": NumberSchema{Required: true}, "name": StringSchema{Required: true}, "calendar_name": StringSchema{}, "first_response_time": NumberSchema{}, "solution_time": NumberSchema{}, "valid_id": NumberSchema{}, }}, Required: true}, "total": NumberSchema{}, }}, }, }, { Name: "GetSLA", Description: "Get single SLA by ID", Method: "GET", Path: "/api/v1/slas/1", Headers: map[string]string{ "Authorization": "Bearer {{token}}", }, Expected: Response{ Status: http.StatusOK, BodySchema: ObjectSchema{Required: true, Properties: map[string]Schema{ "id": NumberSchema{Required: true}, "name": StringSchema{Required: true}, "calendar_name": StringSchema{}, "first_response_time": NumberSchema{}, "solution_time": NumberSchema{}, "valid_id": NumberSchema{}, }}, }, }, { Name: "CreateSLA", Description: "Create new SLA", Method: "POST", Path: "/api/v1/slas", Headers: map[string]string{ "Authorization": "Bearer {{token}}", "Content-Type": "application/json", }, Body: map[string]interface{}{ "name": "Test SLA", "calendar_name": "Default", "first_response_time": 60, "first_response_notify": 50, "update_time": 120, "update_notify": 100, "solution_time": 480, "solution_notify": 400, }, Expected: Response{ Status: http.StatusCreated, BodySchema: ObjectSchema{Required: true, Properties: map[string]Schema{ "id": NumberSchema{Required: true}, "name": StringSchema{Required: true}, "calendar_name": StringSchema{}, "first_response_time": NumberSchema{}, "solution_time": NumberSchema{}, "valid_id": NumberSchema{}, }}, }, }, { Name: "UpdateSLA", Description: "Update existing SLA", Method: "PUT", Path: "/api/v1/slas/1", Headers: map[string]string{ "Authorization": "Bearer {{token}}", "Content-Type": "application/json", }, Body: map[string]interface{}{ "name": "Updated SLA", "first_response_time": 45, "solution_time": 360, }, Expected: Response{ Status: http.StatusOK, BodySchema: ObjectSchema{Required: true, Properties: map[string]Schema{ "id": NumberSchema{Required: true}, "name": StringSchema{Required: true}, "calendar_name": StringSchema{}, "first_response_time": NumberSchema{}, "solution_time": NumberSchema{}, }}, }, }, { Name: "DeleteSLA", Description: "Soft delete SLA", Method: "DELETE", Path: "/api/v1/slas/10", Headers: map[string]string{ "Authorization": "Bearer {{token}}", }, Expected: Response{ Status: http.StatusOK, BodySchema: ObjectSchema{Required: true, Properties: map[string]Schema{ "message": StringSchema{}, "id": NumberSchema{}, }}, }, }, { Name: "SLAMetrics", Description: "Get SLA performance metrics", Method: "GET", Path: "/api/v1/slas/1/metrics", Headers: map[string]string{ "Authorization": "Bearer {{token}}", }, Expected: Response{ Status: http.StatusOK, BodySchema: ObjectSchema{Required: true, Properties: map[string]Schema{ "sla_id": NumberSchema{Required: true}, "sla_name": StringSchema{}, "metrics": ObjectSchema{}, }}, }, }, }
SLAContracts defines the API contracts for SLA endpoints.
var SearchContracts = []Contract{ { Name: "SearchAll", Description: "Search across all entity types", Method: "POST", Path: "/api/v1/search", Headers: map[string]string{ "Authorization": "Bearer {{token}}", "Content-Type": "application/json", }, Body: map[string]interface{}{ "query": "network issue", "types": []string{"ticket", "article", "customer"}, "limit": 10, }, Expected: Response{ Status: http.StatusOK, BodySchema: ObjectSchema{Required: true, Properties: map[string]Schema{ "query": StringSchema{}, "total_hits": NumberSchema{}, "took_ms": NumberSchema{}, "hits": ArraySchema{}, }}, }, }, { Name: "SearchTickets", Description: "Search only tickets", Method: "POST", Path: "/api/v1/search", Headers: map[string]string{ "Authorization": "Bearer {{token}}", "Content-Type": "application/json", }, Body: map[string]interface{}{ "query": "email", "types": []string{"ticket"}, "filters": map[string]string{ "queue_id": "1", "state_id": "1", }, "limit": 20, "offset": 0, }, Expected: Response{ Status: http.StatusOK, BodySchema: ObjectSchema{Required: true, Properties: map[string]Schema{ "hits": ArraySchema{}, }}, }, }, { Name: "SearchWithHighlighting", Description: "Search with result highlighting", Method: "POST", Path: "/api/v1/search", Headers: map[string]string{ "Authorization": "Bearer {{token}}", "Content-Type": "application/json", }, Body: map[string]interface{}{ "query": "password reset", "types": []string{"ticket", "article"}, "highlight": true, "limit": 5, }, Expected: Response{ Status: http.StatusOK, BodySchema: ObjectSchema{Required: true, Properties: map[string]Schema{ "hits": ArraySchema{}, }}, }, }, { Name: "SearchWithPagination", Description: "Search with pagination", Method: "POST", Path: "/api/v1/search", Headers: map[string]string{ "Authorization": "Bearer {{token}}", "Content-Type": "application/json", }, Body: map[string]interface{}{ "query": "customer", "types": []string{"customer"}, "offset": 10, "limit": 10, }, Expected: Response{ Status: http.StatusOK, BodySchema: ObjectSchema{Required: true, Properties: map[string]Schema{ "hits": ArraySchema{}, }}, }, }, { Name: "SearchSuggestions", Description: "Get search suggestions", Method: "GET", Path: "/api/v1/search/suggestions?q=net&type=ticket", Headers: map[string]string{ "Authorization": "Bearer {{token}}", }, Expected: Response{ Status: http.StatusOK, BodySchema: ObjectSchema{Required: true, Properties: map[string]Schema{ "query": StringSchema{}, "type": StringSchema{}, "suggestions": ArraySchema{}, }}, }, }, { Name: "SearchHealth", Description: "Check search backend health", Method: "GET", Path: "/api/v1/search/health", Headers: map[string]string{ "Authorization": "Bearer {{token}}", }, Expected: Response{ Status: http.StatusOK, BodySchema: ObjectSchema{Required: true, Properties: map[string]Schema{ "status": StringSchema{}, "backend": StringSchema{}, }}, }, }, { Name: "Reindex", Description: "Trigger search index rebuild", Method: "POST", Path: "/api/v1/search/reindex", Headers: map[string]string{ "Authorization": "Bearer {{token}}", "Content-Type": "application/json", }, Body: map[string]interface{}{ "types": []string{"ticket", "article"}, "force": false, }, Expected: Response{ Status: http.StatusOK, BodySchema: ObjectSchema{Required: true, Properties: map[string]Schema{ "message": StringSchema{}, "backend": StringSchema{}, }}, }, }, { Name: "EmptySearchQuery", Description: "Search with empty query should fail", Method: "POST", Path: "/api/v1/search", Headers: map[string]string{ "Authorization": "Bearer {{token}}", "Content-Type": "application/json", }, Body: map[string]interface{}{ "query": "", "types": []string{"ticket"}, }, Expected: Response{ Status: http.StatusBadRequest, BodySchema: ObjectSchema{Required: true, Properties: map[string]Schema{ "error": StringSchema{}, }}, }, }, }
SearchContracts defines the API contracts for search endpoints.
var TicketStateContracts = []Contract{ { Name: "ListTicketStates", Description: "List all ticket states", Method: "GET", Path: "/api/v1/ticket-states", Headers: map[string]string{ "Authorization": "Bearer {{token}}", }, Expected: Response{ Status: http.StatusOK, BodySchema: ObjectSchema{Required: true, Properties: map[string]Schema{ "states": ArraySchema{ItemsSchema: ObjectSchema{Properties: map[string]Schema{ "id": NumberSchema{Required: true}, "name": StringSchema{Required: true}, "type_id": NumberSchema{}, "valid_id": NumberSchema{}, }}, Required: true}, "total": NumberSchema{}, }}, }, }, { Name: "GetTicketState", Description: "Get single ticket state by ID", Method: "GET", Path: "/api/v1/ticket-states/1", Headers: map[string]string{ "Authorization": "Bearer {{token}}", }, Expected: Response{ Status: http.StatusOK, BodySchema: ObjectSchema{Required: true, Properties: map[string]Schema{ "id": NumberSchema{Required: true}, "name": StringSchema{Required: true}, "type_id": NumberSchema{}, "valid_id": NumberSchema{}, }}, }, }, { Name: "CreateTicketState", Description: "Create new ticket state", Method: "POST", Path: "/api/v1/ticket-states", Headers: map[string]string{ "Authorization": "Bearer {{token}}", "Content-Type": "application/json", }, Body: map[string]interface{}{ "name": "Test State", "type_id": 1, }, Expected: Response{ Status: http.StatusCreated, BodySchema: ObjectSchema{Required: true, Properties: map[string]Schema{ "id": NumberSchema{Required: true}, "name": StringSchema{Required: true}, "type_id": NumberSchema{}, "valid_id": NumberSchema{}, }}, }, }, { Name: "TicketStateStatistics", Description: "Get ticket state statistics", Method: "GET", Path: "/api/v1/ticket-states/statistics", Headers: map[string]string{ "Authorization": "Bearer {{token}}", }, Expected: Response{ Status: http.StatusOK, BodySchema: ObjectSchema{Required: true, Properties: map[string]Schema{ "statistics": ArraySchema{ItemsSchema: ObjectSchema{Properties: map[string]Schema{ "state_id": NumberSchema{Required: true}, "state_name": StringSchema{Required: true}, "type_id": NumberSchema{}, "ticket_count": NumberSchema{}, }}, Required: true}, "total_tickets": NumberSchema{}, }}, }, }, }
TicketStateContracts defines the API contracts for ticket state endpoints.
Functions ¶
func RegisterArticleContracts ¶
func RegisterArticleContracts()
RegisterArticleContracts registers article contracts for testing.
func RegisterQueuePriorityContracts ¶
func RegisterQueuePriorityContracts()
RegisterQueuePriorityContracts registers queue and priority contracts for testing.
func RegisterSearchContracts ¶
func RegisterSearchContracts()
RegisterSearchContracts registers search contracts for testing.
func RegisterStateSLAContracts ¶
func RegisterStateSLAContracts()
RegisterStateSLAContracts registers ticket state and SLA contracts for testing.
func ValidateSchema ¶
func ValidateSchema(actual interface{}, expected interface{}) error
ValidateSchema validates that a response matches expected schema.
Types ¶
type ArraySchema ¶
ArraySchema validates array fields.
func (ArraySchema) Validate ¶
func (s ArraySchema) Validate(value interface{}) error
type BooleanSchema ¶
type BooleanSchema struct {
Required bool
}
BooleanSchema validates boolean fields.
func (BooleanSchema) Validate ¶
func (s BooleanSchema) Validate(value interface{}) error
type Contract ¶
type Contract struct {
Name string
Description string
Method string
Path string
Headers map[string]string
Body interface{}
Expected Response
}
Contract defines an API contract to be tested.
type ContractTest ¶
type ContractTest struct {
// contains filtered or unexported fields
}
ContractTest runs a contract test against a handler.
func NewContractTest ¶
func NewContractTest(t *testing.T, router *gin.Engine) *ContractTest
NewContractTest creates a new contract test runner.
func (*ContractTest) AddContract ¶
func (ct *ContractTest) AddContract(contract Contract)
AddContract adds a contract to test.
type MockHandlers ¶
type MockHandlers struct{}
MockHandlers provides mock implementations for contract testing.
func (*MockHandlers) HandleAddUserToGroup ¶
func (m *MockHandlers) HandleAddUserToGroup(c *gin.Context)
func (*MockHandlers) HandleAssignTicket ¶
func (m *MockHandlers) HandleAssignTicket(c *gin.Context)
func (*MockHandlers) HandleCloseTicket ¶
func (m *MockHandlers) HandleCloseTicket(c *gin.Context)
Ticket action handlers.
func (*MockHandlers) HandleCreateTicket ¶
func (m *MockHandlers) HandleCreateTicket(c *gin.Context)
func (*MockHandlers) HandleCreateUser ¶
func (m *MockHandlers) HandleCreateUser(c *gin.Context)
func (*MockHandlers) HandleDeleteTicket ¶
func (m *MockHandlers) HandleDeleteTicket(c *gin.Context)
func (*MockHandlers) HandleDeleteUser ¶
func (m *MockHandlers) HandleDeleteUser(c *gin.Context)
func (*MockHandlers) HandleGetTicket ¶
func (m *MockHandlers) HandleGetTicket(c *gin.Context)
func (*MockHandlers) HandleGetUser ¶
func (m *MockHandlers) HandleGetUser(c *gin.Context)
func (*MockHandlers) HandleGetUserGroups ¶
func (m *MockHandlers) HandleGetUserGroups(c *gin.Context)
func (*MockHandlers) HandleListTickets ¶
func (m *MockHandlers) HandleListTickets(c *gin.Context)
Ticket handlers.
func (*MockHandlers) HandleListUsers ¶
func (m *MockHandlers) HandleListUsers(c *gin.Context)
User handlers.
func (*MockHandlers) HandleLogin ¶
func (m *MockHandlers) HandleLogin(c *gin.Context)
Auth handlers.
func (*MockHandlers) HandleLogout ¶
func (m *MockHandlers) HandleLogout(c *gin.Context)
func (*MockHandlers) HandleRefresh ¶
func (m *MockHandlers) HandleRefresh(c *gin.Context)
func (*MockHandlers) HandleRemoveUserFromGroup ¶
func (m *MockHandlers) HandleRemoveUserFromGroup(c *gin.Context)
func (*MockHandlers) HandleReopenTicket ¶
func (m *MockHandlers) HandleReopenTicket(c *gin.Context)
func (*MockHandlers) HandleUpdateTicket ¶
func (m *MockHandlers) HandleUpdateTicket(c *gin.Context)
func (*MockHandlers) HandleUpdateUser ¶
func (m *MockHandlers) HandleUpdateUser(c *gin.Context)
type NumberSchema ¶
NumberSchema validates numeric fields.
func (NumberSchema) Validate ¶
func (s NumberSchema) Validate(value interface{}) error
type ObjectSchema ¶
ObjectSchema validates object fields.
func (ObjectSchema) Validate ¶
func (s ObjectSchema) Validate(value interface{}) error
type Response ¶
type Response struct {
Status int
Headers map[string]string
BodySchema interface{} // Expected response structure
Validations []Validation
}
Response defines expected response characteristics.
type Schema ¶
type Schema interface {
Validate(interface{}) error
}
Schema interface for custom schema validation.
type StringSchema ¶
StringSchema validates string fields.
func (StringSchema) Validate ¶
func (s StringSchema) Validate(value interface{}) error
type Validation ¶
Validation is a custom validation function.
func HasFields ¶
func HasFields(fields ...string) Validation
Helper function to check if response contains expected fields.
func IsErrorResponse ¶
func IsErrorResponse() Validation
Helper function to validate error response format.
func IsSuccessResponse ¶
func IsSuccessResponse() Validation
Helper function to validate success response format.