mirror of
https://github.com/harness/drone.git
synced 2025-05-03 12:12:22 +08:00

* fix merge conflicts * fix merge conflicts * fix review comment * fix review comment * fix review comment * fix: [AH-771]: gitness unit test refactoring * fix: [AH-771]: resolved review comments * fix: [AH-771]: resolved review comments * fix: [AH-771] Registry test refactoring and improvements - Refactored registry metadata test implementations - Improved code organization and readability - Fixed line length issues in test files - Removed unused fields from request.go - Added proper license headers - Fixed linting issues in mock files - Simplified test setup and assertions - Updated wire generation for cmd package - Added nolint:exhaustive directive for package type switch fix: [AH-771] Registry test refactoring and improvements - Refactored registry metadata test implementations - Improved code organization and readability - Fixed line length issues in test files - Removed unused fields from request.go - Added proper license headers - Fixed linting issues in mock files - Simplifi
66 lines
1.9 KiB
Go
66 lines
1.9 KiB
Go
// Code generated by testify. DO NOT EDIT.
|
|
|
|
package mocks
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/harness/gitness/app/auth"
|
|
"github.com/harness/gitness/types"
|
|
"github.com/harness/gitness/types/enum"
|
|
|
|
"github.com/stretchr/testify/mock"
|
|
)
|
|
|
|
// Authorizer is an autogenerated mock type for the Authorizer type
|
|
type Authorizer struct {
|
|
mock.Mock
|
|
}
|
|
|
|
// Check provides a mock function with given fields: ctx, session, scope, resource, permission
|
|
func (m *Authorizer) Check(ctx context.Context, session *auth.Session, scope *types.Scope, resource *types.Resource, permission enum.Permission) (bool, error) {
|
|
ret := m.Called(ctx, session, scope, resource, permission)
|
|
|
|
var r0 bool
|
|
if rf, ok := ret.Get(0).(func(context.Context, *auth.Session, *types.Scope, *types.Resource, enum.Permission) bool); ok {
|
|
r0 = rf(ctx, session, scope, resource, permission)
|
|
} else {
|
|
r0 = ret.Get(0).(bool)
|
|
}
|
|
|
|
var r1 error
|
|
if rf, ok := ret.Get(1).(func(context.Context, *auth.Session, *types.Scope, *types.Resource, enum.Permission) error); ok {
|
|
r1 = rf(ctx, session, scope, resource, permission)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// CheckAll provides a mock function with given fields: ctx, session, permissionChecks
|
|
func (m *Authorizer) CheckAll(ctx context.Context, session *auth.Session, permissionChecks ...types.PermissionCheck) (bool, error) {
|
|
var args []interface{}
|
|
args = append(args, ctx, session)
|
|
for _, check := range permissionChecks {
|
|
args = append(args, check)
|
|
}
|
|
ret := m.Called(args...)
|
|
|
|
var r0 bool
|
|
if rf, ok := ret.Get(0).(func(context.Context, *auth.Session, ...types.PermissionCheck) bool); ok {
|
|
r0 = rf(ctx, session, permissionChecks...)
|
|
} else {
|
|
r0 = ret.Get(0).(bool)
|
|
}
|
|
|
|
var r1 error
|
|
if rf, ok := ret.Get(1).(func(context.Context, *auth.Session, ...types.PermissionCheck) error); ok {
|
|
r1 = rf(ctx, session, permissionChecks...)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|