participant_test.go 612 B

123456789101112131415161718192021222324252627282930313233343536
  1. package file
  2. import (
  3. "os"
  4. "git.andreafazzi.eu/andrea/probo/pkg/models"
  5. "github.com/remogatto/prettytest"
  6. )
  7. type participantTestSuite struct {
  8. prettytest.Suite
  9. }
  10. func (t *participantTestSuite) TestCreate() {
  11. pStore, err := NewDefaultParticipantFileStore()
  12. t.Nil(err)
  13. if !t.Failed() {
  14. p, err := pStore.Create(&models.Participant{
  15. Lastname: "Doe",
  16. Firstname: "John",
  17. Attributes: map[string]string{"class": "1 D LIN"},
  18. })
  19. t.Nil(err)
  20. defer os.Remove(pStore.GetPath(p))
  21. if !t.Failed() {
  22. exists, err := os.Stat(pStore.GetPath(p))
  23. t.Nil(err)
  24. t.Not(t.Nil(exists))
  25. }
  26. }
  27. }