porter_app.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package test
  2. import (
  3. "errors"
  4. "strings"
  5. "github.com/porter-dev/porter/internal/models"
  6. "github.com/porter-dev/porter/internal/repository"
  7. )
  8. type PorterAppRepository struct {
  9. canQuery bool
  10. failingMethods string
  11. }
  12. func NewPorterAppRepository(canQuery bool, failingMethods ...string) repository.PorterAppRepository {
  13. return &PorterAppRepository{canQuery, strings.Join(failingMethods, ",")}
  14. }
  15. func (repo *PorterAppRepository) ReadPorterAppByName(clusterID uint, name string) (*models.PorterApp, error) {
  16. return nil, errors.New("cannot write database")
  17. }
  18. // ReadPorterAppsByProjectIDAndName is a test method that is not implemented
  19. func (repo *PorterAppRepository) ReadPorterAppsByProjectIDAndName(projectID uint, name string) ([]*models.PorterApp, error) {
  20. return nil, errors.New("cannot write database")
  21. }
  22. func (repo *PorterAppRepository) CreatePorterApp(app *models.PorterApp) (*models.PorterApp, error) {
  23. return nil, errors.New("cannot write database")
  24. }
  25. func (repo *PorterAppRepository) UpdatePorterApp(app *models.PorterApp) (*models.PorterApp, error) {
  26. return nil, errors.New("cannot write database")
  27. }
  28. func (repo *PorterAppRepository) ListPorterAppByClusterID(clusterID uint) ([]*models.PorterApp, error) {
  29. return nil, errors.New("cannot write database")
  30. }
  31. func (repo *PorterAppRepository) DeletePorterApp(app *models.PorterApp) (*models.PorterApp, error) {
  32. return nil, errors.New("cannot write database")
  33. }