mirror of
https://github.com/lordmathis/lemma.git
synced 2025-11-05 23:44:22 +00:00
Run integration tests with both dbs
This commit is contained in:
@@ -15,21 +15,12 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// Helper function to check if a user exists in a slice of users
|
||||
func containsUser(users []*models.User, searchUser *models.User) bool {
|
||||
for _, u := range users {
|
||||
if u.ID == searchUser.ID &&
|
||||
u.Email == searchUser.Email &&
|
||||
u.DisplayName == searchUser.DisplayName &&
|
||||
u.Role == searchUser.Role {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
func TestAdminHandlers_Integration(t *testing.T) {
|
||||
runWithDatabases(t, testAdminHandlers)
|
||||
}
|
||||
|
||||
func TestAdminHandlers_Integration(t *testing.T) {
|
||||
h := setupTestHarness(t)
|
||||
func testAdminHandlers(t *testing.T, dbConfig DatabaseConfig) {
|
||||
h := setupTestHarness(t, dbConfig)
|
||||
defer h.teardown(t)
|
||||
|
||||
t.Run("user management", func(t *testing.T) {
|
||||
@@ -241,3 +232,16 @@ func TestAdminHandlers_Integration(t *testing.T) {
|
||||
assert.Equal(t, http.StatusForbidden, rr.Code)
|
||||
})
|
||||
}
|
||||
|
||||
// Helper function to check if a user exists in a slice of users
|
||||
func containsUser(users []*models.User, searchUser *models.User) bool {
|
||||
for _, u := range users {
|
||||
if u.ID == searchUser.ID &&
|
||||
u.Email == searchUser.Email &&
|
||||
u.DisplayName == searchUser.DisplayName &&
|
||||
u.Role == searchUser.Role {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user