2023-11-18 11:12:07 +01:00
|
|
|
package file
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
|
2024-02-06 09:03:57 +01:00
|
|
|
"git.andreafazzi.eu/andrea/probo/pkg/models"
|
2023-11-18 11:12:07 +01:00
|
|
|
"github.com/remogatto/prettytest"
|
|
|
|
)
|
|
|
|
|
|
|
|
type participantTestSuite struct {
|
|
|
|
prettytest.Suite
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t *participantTestSuite) TestCreate() {
|
2023-12-27 15:05:11 +01:00
|
|
|
pStore, err := NewDefaultParticipantFileStore()
|
2023-11-18 11:12:07 +01:00
|
|
|
t.Nil(err)
|
|
|
|
|
|
|
|
if !t.Failed() {
|
|
|
|
p, err := pStore.Create(&models.Participant{
|
|
|
|
Lastname: "Doe",
|
|
|
|
Firstname: "John",
|
|
|
|
Attributes: map[string]string{"class": "1 D LIN"},
|
|
|
|
})
|
|
|
|
|
|
|
|
t.Nil(err)
|
|
|
|
|
|
|
|
defer os.Remove(pStore.GetPath(p))
|
|
|
|
|
|
|
|
if !t.Failed() {
|
|
|
|
exists, err := os.Stat(pStore.GetPath(p))
|
|
|
|
|
|
|
|
t.Nil(err)
|
|
|
|
t.Not(t.Nil(exists))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|