generated from ariel17/golang-base
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
5 changed files
with
136 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package clients | ||
|
||
import ( | ||
"github.com/stretchr/testify/mock" | ||
) | ||
|
||
type MockAPIClient struct { | ||
mock.Mock | ||
} | ||
|
||
func (m *MockAPIClient) GetLeagueByCode(code string) (*League, error) { | ||
args := m.Called(code) | ||
league, ok := args.Get(0).(*League) | ||
if !ok { | ||
return nil, args.Error(1) | ||
} | ||
return league, args.Error(1) | ||
} | ||
|
||
func (m *MockAPIClient) GetTeamsByLeagueCode(code string) ([]Team, error) { | ||
args := m.Called(code) | ||
teams, ok := args.Get(0).([]Team) | ||
if !ok { | ||
return nil, args.Error(1) | ||
} | ||
return teams, args.Error(1) | ||
} | ||
|
||
func (m *MockAPIClient) GetTeamByID(id int64) (*Team, error) { | ||
args := m.Called(id) | ||
team, ok := args.Get(0).(*Team) | ||
if !ok { | ||
return nil, args.Error(1) | ||
} | ||
return team, args.Error(1) | ||
} | ||
|
||
func (m *MockAPIClient) GetPersonByID(id int64) (*Person, error) { | ||
args := m.Called(id) | ||
person, ok := args.Get(0).(*Person) | ||
if !ok { | ||
return nil, args.Error(1) | ||
} | ||
return person, args.Error(1) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package repositories | ||
|
||
import ( | ||
"github.com/stretchr/testify/mock" | ||
|
||
"github.com/ariel17/be-challenge-arios/pkg/models" | ||
) | ||
|
||
type MockRepository struct { | ||
mock.Mock | ||
} | ||
|
||
func (m *MockRepository) Connect() error { | ||
args := m.Called() | ||
return args.Error(0) | ||
} | ||
|
||
func (m *MockRepository) Close() error { | ||
args := m.Called() | ||
return args.Error(0) | ||
} | ||
|
||
func (m *MockRepository) GetStatus() error { | ||
args := m.Called() | ||
return args.Error(0) | ||
} | ||
|
||
func (m *MockRepository) AddPerson(person models.Person) error { | ||
args := m.Called(person) | ||
return args.Error(0) | ||
} | ||
|
||
func (m *MockRepository) AddTeam(team models.Team) error { | ||
args := m.Called(team) | ||
return args.Error(0) | ||
} | ||
|
||
func (m *MockRepository) AddCompetition(competition models.Competition) error { | ||
args := m.Called(competition) | ||
return args.Error(0) | ||
} | ||
|
||
func (m *MockRepository) AddTeamToCompetition(team models.Team, competition models.Competition) error { | ||
args := m.Called(team, competition) | ||
return args.Error(0) | ||
} | ||
|
||
func (m *MockRepository) AddPersonToTeam(person models.Person, team models.Team) error { | ||
args := m.Called(person, team) | ||
return args.Error(0) | ||
} | ||
|
||
func (m *MockRepository) GetTeamByTLA(tla string) (*models.Team, error) { | ||
args := m.Called(tla) | ||
return args.Get(0).(*models.Team), args.Error(1) | ||
} | ||
|
||
func (m *MockRepository) GetPersonsByCompetitionCode(code string) ([]models.Person, error) { | ||
args := m.Called(code) | ||
return args.Get(0).([]models.Person), args.Error(1) | ||
} | ||
|
||
func (m *MockRepository) GetPersonsByTeamTLA(tla string) ([]models.Person, error) { | ||
args := m.Called(tla) | ||
return args.Get(0).([]models.Person), args.Error(1) | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package services | ||
|
||
import ( | ||
"github.com/stretchr/testify/mock" | ||
) | ||
|
||
type MockImporterService struct { | ||
mock.Mock | ||
} | ||
|
||
func (m *MockImporterService) ImportDataByCompetitionCode(code string) error { | ||
args := m.Called(code) | ||
return args.Error(0) | ||
} | ||
|
||
type MockStatusService struct { | ||
mock.Mock | ||
} | ||
|
||
// GetStatus checks the application's health and returns and object describing | ||
// it. | ||
func (m *MockStatusService) GetStatus() Status { | ||
args := m.Called() | ||
return args.Get(0).(Status) | ||
} |