participant_test.go 971 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package store
  2. import (
  3. "git.andreafazzi.eu/andrea/probo/models"
  4. "github.com/remogatto/prettytest"
  5. )
  6. type participantTestSuite struct {
  7. prettytest.Suite
  8. }
  9. func (t *participantTestSuite) TestCreate() {
  10. store := NewStore[*models.Participant]()
  11. p_1, err := store.Create(&models.Participant{
  12. Lastname: "Doe",
  13. Firstname: "John",
  14. })
  15. t.Nil(err)
  16. p_2, err := store.Create(&models.Participant{
  17. Lastname: "Doe",
  18. Firstname: "John",
  19. Attributes: map[string]string{"class": "1 D LIN"},
  20. })
  21. t.Nil(err)
  22. t.False(p_1.GetHash() == p_2.GetHash())
  23. }
  24. func (t *participantTestSuite) TestUpdate() {
  25. store := NewStore[*models.Participant]()
  26. p, err := store.Create(&models.Participant{
  27. Lastname: "Doe",
  28. Firstname: "John",
  29. })
  30. t.Nil(err)
  31. updatedP, err := store.Update(&models.Participant{
  32. Lastname: "Doe",
  33. Firstname: "John",
  34. Attributes: map[string]string{"class": "1 D LIN"},
  35. }, p.ID)
  36. t.Nil(err)
  37. t.False(p.GetHash() == updatedP.GetHash())
  38. }