2021-01-29 18:50:20 +02:00
|
|
|
package storetests
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/mattermost/focalboard/server/model"
|
|
|
|
"github.com/mattermost/focalboard/server/services/store"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
2021-07-08 16:36:43 +02:00
|
|
|
func InsertBlocks(t *testing.T, s store.Store, container store.Container, blocks []model.Block, userID string) {
|
2021-07-09 05:41:54 +02:00
|
|
|
for i := range blocks {
|
|
|
|
err := s.InsertBlock(container, &blocks[i], userID)
|
2021-01-29 18:50:20 +02:00
|
|
|
require.NoError(t, err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-26 20:01:54 +02:00
|
|
|
func DeleteBlocks(t *testing.T, s store.Store, container store.Container, blocks []model.Block, modifiedBy string) {
|
2021-01-29 18:50:20 +02:00
|
|
|
for _, block := range blocks {
|
2021-03-26 20:01:54 +02:00
|
|
|
err := s.DeleteBlock(container, block.ID, modifiedBy)
|
2021-01-29 18:50:20 +02:00
|
|
|
require.NoError(t, err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func ContainsBlockWithID(blocks []model.Block, blockID string) bool {
|
|
|
|
for _, block := range blocks {
|
|
|
|
if block.ID == blockID {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false
|
|
|
|
}
|