authorization

package
v0.0.0-...-9b598c7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigProviders

func ConfigProviders() di.Option

func ServiceProviders

func ServiceProviders() di.Option

Types

type Authorization

type Authorization interface {
	CheckUserValid(username string, orgId string) (bool, error)
}

func NewAuthorization

func NewAuthorization(ocmConfig *ocm.OCMConfig) Authorization

func NewMockAuthorization

func NewMockAuthorization() Authorization

func NewOCMAuthorization

func NewOCMAuthorization(client *sdkClient.Connection) Authorization

type AuthorizationMock

type AuthorizationMock struct {
	// CheckUserValidFunc mocks the CheckUserValid method.
	CheckUserValidFunc func(username string, orgId string) (bool, error)
	// contains filtered or unexported fields
}

AuthorizationMock is a mock implementation of Authorization.

func TestSomethingThatUsesAuthorization(t *testing.T) {

	// make and configure a mocked Authorization
	mockedAuthorization := &AuthorizationMock{
		CheckUserValidFunc: func(username string, orgId string) (bool, error) {
			panic("mock out the CheckUserValid method")
		},
	}

	// use mockedAuthorization in code that requires Authorization
	// and then make assertions.

}

func (*AuthorizationMock) CheckUserValid

func (mock *AuthorizationMock) CheckUserValid(username string, orgId string) (bool, error)

CheckUserValid calls CheckUserValidFunc.

func (*AuthorizationMock) CheckUserValidCalls

func (mock *AuthorizationMock) CheckUserValidCalls() []struct {
	Username string
	OrgId    string
}

CheckUserValidCalls gets all the calls that were made to CheckUserValid. Check the length with:

len(mockedAuthorization.CheckUserValidCalls())

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL