RBAC: Cleaup team api rbac tests (#57265)
* RBAC: Remove the access control evaluator fake * API: Change to use access control implementation instead of mocks with rbac disabled in tests * Tests: Set cfg and access control defaults after applying options * Tests: Rewrite team legacy access control tests * Tests: Add helper function to create user with permissions * Tests: set fake quota service as default * Team: Add ExpectedTeamDTO and set in query result * RBAC: Revert change * RBAC: Add deprecation notice to mock
This commit is contained in:
@@ -53,6 +53,7 @@ type Mock struct {
|
||||
// Ensure the mock stays in line with the interface
|
||||
var _ fullAccessControl = New()
|
||||
|
||||
// Deprecated: use fake service and real access control evaluator instead
|
||||
func New() *Mock {
|
||||
mock := &Mock{
|
||||
Calls: Calls{},
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
|
||||
type FakeService struct {
|
||||
ExpectedTeam models.Team
|
||||
ExpectedTeamDTO *models.TeamDTO
|
||||
ExpectedTeamsByUser []*models.TeamDTO
|
||||
ExpectedMembers []*models.TeamMemberDTO
|
||||
ExpectedError error
|
||||
@@ -34,6 +35,7 @@ func (s *FakeService) SearchTeams(ctx context.Context, query *models.SearchTeams
|
||||
}
|
||||
|
||||
func (s *FakeService) GetTeamById(ctx context.Context, query *models.GetTeamByIdQuery) error {
|
||||
query.Result = s.ExpectedTeamDTO
|
||||
return s.ExpectedError
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user