mirror of
https://github.com/pushbits/server.git
synced 2025-06-05 20:22:01 +02:00
Merge remote-tracking branch 'origin/main' into alertmanager-interface
This commit is contained in:
commit
a0ec05ab2c
18 changed files with 65 additions and 56 deletions
|
@ -19,12 +19,14 @@ import (
|
|||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
var TestApplicationHandler *ApplicationHandler
|
||||
var TestUsers []*model.User
|
||||
var TestDatabase *database.Database
|
||||
var TestNotificationHandler *NotificationHandler
|
||||
var TestUserHandler *UserHandler
|
||||
var TestConfig *configuration.Configuration
|
||||
var (
|
||||
TestApplicationHandler *ApplicationHandler
|
||||
TestUsers []*model.User
|
||||
TestDatabase *database.Database
|
||||
TestNotificationHandler *NotificationHandler
|
||||
TestUserHandler *UserHandler
|
||||
TestConfig *configuration.Configuration
|
||||
)
|
||||
|
||||
// Collect all created applications to check & delete them later
|
||||
var SuccessAplications map[uint][]model.Application
|
||||
|
@ -95,7 +97,6 @@ func TestApi_RegisterApplicationWithoutUser(t *testing.T) {
|
|||
}
|
||||
|
||||
assert.Panicsf(func() { TestApplicationHandler.CreateApplication(c) }, "CreateApplication did not panic altough user is not in context")
|
||||
|
||||
}
|
||||
|
||||
func TestApi_RegisterApplication(t *testing.T) {
|
||||
|
@ -186,7 +187,6 @@ func TestApi_GetApplicationsWithoutUser(t *testing.T) {
|
|||
}
|
||||
|
||||
assert.Panicsf(func() { TestApplicationHandler.GetApplications(c) }, "GetApplications did not panic altough user is not in context")
|
||||
|
||||
}
|
||||
|
||||
func TestApi_GetApplicationErrors(t *testing.T) {
|
||||
|
|
|
@ -13,8 +13,7 @@ import (
|
|||
)
|
||||
|
||||
// The NotificationDatabase interface for encapsulating database access.
|
||||
type NotificationDatabase interface {
|
||||
}
|
||||
type NotificationDatabase interface{}
|
||||
|
||||
// The NotificationDispatcher interface for relaying notifications.
|
||||
type NotificationDispatcher interface {
|
||||
|
|
|
@ -61,7 +61,6 @@ func TestApi_CreateNotification(t *testing.T) {
|
|||
|
||||
assert.Equalf(w.Code, req.ShouldStatus, "(Test case: \"%s\") Expected status code %v but have %v.", req.Name, req.ShouldStatus, w.Code)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestApi_DeleteNotification(t *testing.T) {
|
||||
|
@ -93,5 +92,4 @@ func TestApi_DeleteNotification(t *testing.T) {
|
|||
|
||||
assert.Equalf(w.Code, req.ShouldStatus, "(Test case: \"%s\") Expected status code %v but have %v.", req.Name, req.ShouldStatus, w.Code)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -216,7 +216,6 @@ func TestApi_DeleteUser(t *testing.T) {
|
|||
|
||||
assert.Equalf(testCase.ShouldStatus, w.Code, "(Test case %s) Expected status code %d but have %d", testCase.Name, testCase.ShouldStatus, w.Code)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func getAdmin() *model.User {
|
||||
|
|
|
@ -19,8 +19,7 @@ func TestApi_SuccessOrAbort(t *testing.T) {
|
|||
testCases[errors.New("this is an error")] = tests.Request{Name: "Error - 500", Endpoint: "/", ShouldStatus: 500}
|
||||
testCases[errors.New("this is an error")] = tests.Request{Name: "Error - 200", Endpoint: "/", ShouldStatus: 200}
|
||||
testCases[errors.New("this is an error")] = tests.Request{Name: "Error - 404", Endpoint: "/", ShouldStatus: 404}
|
||||
testCases[errors.New("this is an error")] = tests.Request{Name: "Error - 1001", Endpoint: "/", ShouldStatus: 1001}
|
||||
testCases[nil] = tests.Request{Name: "No Error - 1001", Endpoint: "/", ShouldStatus: 1001}
|
||||
testCases[nil] = tests.Request{Name: "No Error - 200", Endpoint: "/", ShouldStatus: 200}
|
||||
testCases[nil] = tests.Request{Name: "No Error - 404", Endpoint: "/", ShouldStatus: 404}
|
||||
|
||||
for forcedErr, testCase := range testCases {
|
||||
|
@ -62,5 +61,4 @@ func TestApi_IsCurrentUser(t *testing.T) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue