Documentation
¶
Overview ¶
This file was generated by counterfeiter
Index ¶
- Variables
- func ActivateDummyClusterCacheFactory(w wrapper.Wrapper, cache cluster.ClusterCache)
- func ActivateDummyIdentityProviderFactory(w wrapper.Wrapper, provider provider.IdentityProvider)
- func ActivateDummyLinkingProviderFactory(w wrapper.Wrapper, config *configuration.ConfigurationData, token string, ...)
- func AssertError(t require.TestingT, actualError error, expectedType interface{}, ...)
- func AssertIdentityEqual(t require.TestingT, expected, actual *account.Identity)
- func AssertIdentityObfuscated(t require.TestingT, expected, actual *account.Identity)
- func AssertIdentitySoftDeleted(t require.TestingT, actual *account.Identity)
- func ClusterByURL(url string) *cluster.Cluster
- func CreateBannedTestIdentityAndUser(db *gorm.DB, username string) (account.Identity, error)
- func CreateLonelyTestIdentity(db *gorm.DB, username string) (account.Identity, error)
- func CreateRandomIdentityRole(ctx context.Context, db *gorm.DB) (*role.IdentityRole, error)
- func CreateRandomValidTestName(name string) string
- func CreateTestIdentity(db *gorm.DB, username, providerType string) (account.Identity, error)
- func CreateTestIdentityAndUser(db *gorm.DB, username, providerType string) (account.Identity, error)
- func CreateTestIdentityAndUserInDB(db *gorm.DB, identity *account.Identity) error
- func CreateTestIdentityAndUserWithDefaultProviderType(db *gorm.DB, username string) (account.Identity, error)
- func CreateTestIdentityForAccountIdentity(db *gorm.DB, identity *account.Identity) error
- func CreateTestIdentityRole(ctx context.Context, db *gorm.DB, resourceRef resource.Resource, ...) (*role.IdentityRole, error)
- func CreateTestIdentityRoleForIdentity(ctx context.Context, db *gorm.DB, identity account.Identity, ...) (*role.IdentityRole, error)
- func CreateTestOrganization(ctx context.Context, db *gorm.DB, app application.Application, ...) (account.Identity, error)
- func CreateTestOrganizationIdentity(db *gorm.DB) (account.Identity, error)
- func CreateTestResource(ctx context.Context, db *gorm.DB, resourceType resourcetype.ResourceType, ...) (*resource.Resource, error)
- func CreateTestResourceType(ctx context.Context, db *gorm.DB, name string) (*resourcetype.ResourceType, error)
- func CreateTestResourceWithDefaultType(ctx context.Context, db *gorm.DB, name string) (*resource.Resource, error)
- func CreateTestRole(ctx context.Context, db *gorm.DB, resourceType resourcetype.ResourceType, ...) (*role.Role, error)
- func CreateTestRoleMapping(ctx context.Context, db *gorm.DB, app application.Application, ...) error
- func CreateTestRoleScope(ctx context.Context, db *gorm.DB, s resourcetype.ResourceTypeScope, ...) (*role.RoleScope, error)
- func CreateTestRoleWithDefaultType(ctx context.Context, db *gorm.DB, name string) (*role.Role, error)
- func CreateTestRoleWithSpecifiedType(ctx context.Context, db *gorm.DB, name string, resourceTypeName string) (*role.Role, error)
- func CreateTestScope(ctx context.Context, db *gorm.DB, resourceType resourcetype.ResourceType, ...) (*resourcetype.ResourceTypeScope, error)
- func CreateTestScopeWithDefaultType(ctx context.Context, db *gorm.DB, name string) (*resourcetype.ResourceTypeScope, error)
- func CreateTestUser(db *gorm.DB, user *account.User) (account.Identity, error)
- func EmbedTestIdentityTokenInContext(db *gorm.DB, username string) (account.Identity, context.Context, error)
- func EqualURLs(t *testing.T, expected string, actual string)
- func NewClusterServiceMock(t minimock.Tester) *testservice.ClusterServiceMock
- func NewDummyClusterCache() cluster.ClusterCache
- func NewDummyClusterCacheWithClusters(value map[string]cluster.Cluster) cluster.ClusterCache
- func Run(b *testing.B, suite BenchingSuite)
- func ServiceAsServiceAccountUser(serviceName string, u account.Identity) *goa.Service
- func ServiceAsUser(serviceName string, u account.Identity) *goa.Service
- func ServiceAsUserWithIncompleteClaims(serviceName string, u account.Identity) *goa.Service
- func UnsecuredService(serviceName string) *goa.Service
- func WithIdentity(ctx context.Context, ident account.Identity) context.Context
- func WithIncompleteIdentity(ctx context.Context, ident account.Identity) context.Context
- func WithServiceAccountAuthz(ctx context.Context, tokenManager manager.TokenManager, ident account.Identity) context.Context
- type AfterBenchmark
- type BeforeBenchmark
- type BenchingSuite
- type DummyHttpClient
- type DummyHttpDoer
- type DummyLinkingProvider
- func (p *DummyLinkingProvider) AuthCodeURL(state string, opts ...oauth2.AuthCodeOption) string
- func (p *DummyLinkingProvider) Exchange(ctx netcontext.Context, code string) (*oauth2.Token, error)
- func (p *DummyLinkingProvider) ID() uuid.UUID
- func (provider *DummyLinkingProvider) OSOCluster() cluster.Cluster
- func (p *DummyLinkingProvider) Profile(ctx context.Context, token oauth2.Token) (*provider.UserProfile, error)
- func (p *DummyLinkingProvider) Scopes() string
- func (p *DummyLinkingProvider) SetRedirectURL(redirectURL string)
- func (p *DummyLinkingProvider) SetScopes(scopes []string)
- func (p *DummyLinkingProvider) TypeName() string
- func (p *DummyLinkingProvider) URL() string
- type SetupAllSuite
- type SetupBenchmarkSuite
- type Suite
- type TearDownAllSuite
- type TearDownBenchmarkSuite
Constants ¶
This section is empty.
Variables ¶
var TestAdminConsoleIdentity = account.Identity{ ID: uuid.NewV4(), Username: "fabric8-admin", User: TestUser, }
var TestIdentity = account.Identity{ ID: uuid.NewV4(), Username: "TestDeveloper" + uuid.NewV4().String(), User: TestUser, ProviderType: account.DefaultIDP, }
TestIdentity only creates in memory obj for testing purposes
var TestIdentity2 = account.Identity{ ID: uuid.NewV4(), Username: "TestDeveloper2" + uuid.NewV4().String(), User: TestUser2, ProviderType: account.DefaultIDP, }
TestIdentity2 only creates in memory obj for testing purposes
var TestNotificationIdentity = account.Identity{ ID: uuid.NewV4(), Username: "fabric8-notification", User: TestUser, }
var TestObserverIdentity = account.Identity{ ID: uuid.NewV4(), Username: "TestObserver", User: TestUser, }
TestObserverIdentity only creates in memory obj for testing purposes
var TestOnlineRegistrationAppIdentity = account.Identity{ ID: uuid.NewV4(), Username: "online-registration", User: TestUser, }
var TestTenantIdentity = account.Identity{ ID: uuid.NewV4(), Username: "fabric8-tenant", User: TestUser, }
var TestUser = account.User{ ID: uuid.NewV4(), Email: "[email protected]" + uuid.NewV4().String(), FullName: "Test Developer", Cluster: "https://api.starter-us-east-2.openshift.com", }
TestUser only creates in memory obj for testing purposes
var TestUser2 = account.User{ ID: uuid.NewV4(), Email: "[email protected]" + uuid.NewV4().String(), FullName: "Test Developer 2", Cluster: "https://api.starter-us-east-2.openshift.com", }
TestUser2 only creates in memory obj for testing purposes. This TestUser2 can be used to verify that some entity created by TestUser can be later updated or deleted (or not) by another user.
var TestUser3 = account.User{ ID: uuid.NewV4(), Email: uuid.NewV4().String(), FullName: "Test Developer", Cluster: "https://api.starter-us-east-2.openshift.com", }
TestUser only creates in memory obj for testing purposes
var TestUserPrivate = account.User{ ID: uuid.NewV4(), Email: uuid.NewV4().String(), FullName: "Test Developer", Cluster: "https://api.starter-us-east-2.openshift.com", EmailPrivate: true, }
TestUserPrivate only creates in memory obj for testing purposes
Functions ¶
func ActivateDummyClusterCacheFactory ¶
func ActivateDummyClusterCacheFactory(w wrapper.Wrapper, cache cluster.ClusterCache)
func ActivateDummyIdentityProviderFactory ¶
func ActivateDummyIdentityProviderFactory(w wrapper.Wrapper, provider provider.IdentityProvider)
func ActivateDummyLinkingProviderFactory ¶
func ActivateDummyLinkingProviderFactory(w wrapper.Wrapper, config *configuration.ConfigurationData, token string, loadProfileFail bool, authCodeURL string)
TODO this is getting a little out of hand, look into other ways to initialize the factory ActivateDummyLinkingProviderFactory can be used to create a mock linking provider factory
func AssertError ¶
func AssertIdentityEqual ¶
func AssertIdentityObfuscated ¶
AssertIdentityObfuscated verifies that the `actual` identity was obfuscated, ie, all the personal data were replaced with UUID values, except a few fields
func AssertIdentitySoftDeleted ¶
AssertIdentitySoftDeleted verifies that the `actual` identity was soft-delete
func ClusterByURL ¶
func CreateLonelyTestIdentity ¶
CreateLonelyTestIdentity creates an identity not associated with any user. For testing purpose only.
func CreateRandomValidTestName ¶
CreateRandomValidTestName functions creates a valid length name
func CreateTestIdentity ¶
CreateTestIdentity creates an identity with the given `username` in the database. For testing purpose only.
func CreateTestIdentityAndUser ¶
func CreateTestIdentityAndUser(db *gorm.DB, username, providerType string) (account.Identity, error)
CreateTestIdentityAndUser creates an identity & user with the given `username` in the database. For testing purpose only.
func CreateTestIdentityAndUserInDB ¶
CreateTestIdentityAndUserInDB creates an account.Identity and account.User in the database. For testing purpose only. Not re-using CreateTestIdentityForAccountIdentity because it is used in many places and will cause errors/failures. This function unlike CreateTestIdentity() allows to create an Identity with pre-defined ID.
func CreateTestIdentityAndUserWithDefaultProviderType ¶
func CreateTestIdentityAndUserWithDefaultProviderType(db *gorm.DB, username string) (account.Identity, error)
CreateTestIdentityAndUserWithDefaultProviderType creates an identity & user with the given `username` in the database. For testing purpose only.
func CreateTestIdentityForAccountIdentity ¶
CreateTestIdentityForAccountIdentity creates an account.Identity in the database. For testing purpose only. This function unlike CreateTestIdentity() allows to create an Identity with pre-defined ID.
func CreateTestIdentityRole ¶
func CreateTestOrganization ¶
func CreateTestOrganization(ctx context.Context, db *gorm.DB, app application.Application, creatorIdentityID uuid.UUID, name string) (account.Identity, error)
func CreateTestOrganizationIdentity ¶
CreateTestOrganizationIdentity creates an identity/resource pair in the database. For testing purposes only.
func CreateTestResource ¶
func CreateTestResourceType ¶
func CreateTestResourceType(ctx context.Context, db *gorm.DB, name string) (*resourcetype.ResourceType, error)
func CreateTestRole ¶
func CreateTestRole(ctx context.Context, db *gorm.DB, resourceType resourcetype.ResourceType, name string) (*role.Role, error)
func CreateTestRoleMapping ¶
func CreateTestRoleMapping(ctx context.Context, db *gorm.DB, app application.Application, resourceID string, fromRoleID uuid.UUID, toRoleID uuid.UUID) error
func CreateTestRoleScope ¶
func CreateTestScope ¶
func CreateTestScope(ctx context.Context, db *gorm.DB, resourceType resourcetype.ResourceType, name string) (*resourcetype.ResourceTypeScope, error)
func CreateTestScopeWithDefaultType ¶
func CreateTestScopeWithDefaultType(ctx context.Context, db *gorm.DB, name string) (*resourcetype.ResourceTypeScope, error)
func CreateTestUser ¶
CreateTestUser creates a new user from a given user object
func EmbedTestIdentityTokenInContext ¶
func EmbedTestIdentityTokenInContext(db *gorm.DB, username string) (account.Identity, context.Context, error)
EmbedTestIdentityTokenInContext creates an identity & user with the given `username` in the database. Generates a token for that identity and embed the token in the context.
func NewClusterServiceMock ¶
func NewClusterServiceMock(t minimock.Tester) *testservice.ClusterServiceMock
func NewDummyClusterCache ¶
func NewDummyClusterCache() cluster.ClusterCache
func NewDummyClusterCacheWithClusters ¶
func NewDummyClusterCacheWithClusters(value map[string]cluster.Cluster) cluster.ClusterCache
func Run ¶
func Run(b *testing.B, suite BenchingSuite)
Run takes a testing suite and runs all of the benchmarks attached to it.
func ServiceAsServiceAccountUser ¶
ServiceAsServiceAccountUser generates the minimal service needed to satisfy the condition of being a service account.
func ServiceAsUser ¶
ServiceAsUser creates a new service and fill the context with input Identity
func ServiceAsUserWithIncompleteClaims ¶
ServiceAsUserWithIncompleteClaims creates a new service and fill the context with input Identity
func UnsecuredService ¶
UnsecuredService creates a new service with token manager injected by without any identity in context
func WithIdentity ¶
WithIdentity fills the context with token Token is filled using input Identity object
func WithIncompleteIdentity ¶
WithIncompleteIdentity fills the context with token Token is filled using input Identity object but without the sub claim
func WithServiceAccountAuthz ¶
func WithServiceAccountAuthz(ctx context.Context, tokenManager manager.TokenManager, ident account.Identity) context.Context
WithServiceAccountAuthz fills the context with token Token is filled using input Identity object and resource authorization information
Types ¶
type AfterBenchmark ¶
type AfterBenchmark interface {
AfterBenchmark(suiteName, testName string)
}
AfterBenchmark has a function to be executed right after the benchmark finishes and receives the suite and benchmark names as input
type BeforeBenchmark ¶
type BeforeBenchmark interface {
BeforeBenchmark(suiteName, testName string)
}
BeforeBenchmark has a function to be executed right before the benchmark starts and receives the suite and benchmark names as input
type BenchingSuite ¶
BenchingSuite can store and return the current *testing.B context generated by 'go test -bench=.'.
type DummyHttpClient ¶
type DummyHttpDoer ¶
type DummyHttpDoer struct { *rest.HttpClientDoer Client *DummyHttpClient }
func NewDummyHttpDoer ¶
func NewDummyHttpDoer() *DummyHttpDoer
type DummyLinkingProvider ¶
type DummyLinkingProvider struct {
// contains filtered or unexported fields
}
func (*DummyLinkingProvider) AuthCodeURL ¶
func (p *DummyLinkingProvider) AuthCodeURL(state string, opts ...oauth2.AuthCodeOption) string
func (*DummyLinkingProvider) Exchange ¶
func (p *DummyLinkingProvider) Exchange(ctx netcontext.Context, code string) (*oauth2.Token, error)
func (*DummyLinkingProvider) ID ¶
func (p *DummyLinkingProvider) ID() uuid.UUID
func (*DummyLinkingProvider) OSOCluster ¶
func (provider *DummyLinkingProvider) OSOCluster() cluster.Cluster
func (*DummyLinkingProvider) Profile ¶
func (p *DummyLinkingProvider) Profile(ctx context.Context, token oauth2.Token) (*provider.UserProfile, error)
func (*DummyLinkingProvider) Scopes ¶
func (p *DummyLinkingProvider) Scopes() string
func (*DummyLinkingProvider) SetRedirectURL ¶
func (p *DummyLinkingProvider) SetRedirectURL(redirectURL string)
func (*DummyLinkingProvider) SetScopes ¶
func (p *DummyLinkingProvider) SetScopes(scopes []string)
func (*DummyLinkingProvider) TypeName ¶
func (p *DummyLinkingProvider) TypeName() string
func (*DummyLinkingProvider) URL ¶
func (p *DummyLinkingProvider) URL() string
type SetupAllSuite ¶
type SetupAllSuite interface {
SetupSuite()
}
SetupAllSuite has a SetupSuite method, which will run before the benchmarks in the suite are run.
type SetupBenchmarkSuite ¶
type SetupBenchmarkSuite interface {
SetupBenchmark()
}
SetupBenchmarkSuite has a SetupBenchmark method, which will run before each benchmark in the suite.
type Suite ¶
type Suite struct {
// contains filtered or unexported fields
}
Suite is a basic testing suite with methods for storing and retrieving the current *testing.B context.
type TearDownAllSuite ¶
type TearDownAllSuite interface {
TearDownSuite()
}
TearDownAllSuite has a TearDownSuite method, which will run after all the benchmarks in the suite have been run.
type TearDownBenchmarkSuite ¶
type TearDownBenchmarkSuite interface {
TearDownBenchmark()
}
TearDownBenchmarkSuite has a TearDownBenchmark method, which will run after each benchmark in the suite.