Documentation
¶
Index ¶
- Variables
- type FakeOrganization
- func (o *FakeOrganization) AddUser(db database.Database, userOptions ...UserOption) *FakeUser
- func (o *FakeOrganization) Delete(db database.Database)
- func (o *FakeOrganization) FetchLatest(db database.Database) *FakeOrganization
- func (o *FakeOrganization) IsDeleted(db database.Database) bool
- func (o *FakeOrganization) IsSuspended(db database.Database) bool
- type FakeUser
- type OrganizationOption
- type UserOption
Constants ¶
This section is empty.
Variables ¶
var ( MockBool = mock.AnythingOfType("bool") MockBoolPtr = mock.AnythingOfType("*bool") MockInt64 = mock.AnythingOfType("int64") MockInt64Ptr = mock.AnythingOfType("*int64") MockString = mock.AnythingOfType("string") MockStringPtr = mock.AnythingOfType("*string") MockTime = mock.AnythingOfType("time.Time") MockTimePtr = mock.AnythingOfType("*time.Time") MockContext = mock.MatchedBy(func(_ context.Context) bool { return true }) )
Functions ¶
This section is empty.
Types ¶
type FakeOrganization ¶
type FakeOrganization struct {
organization.Organization
}
FakeOrganization is a fake organization for testing. It embeds the organization.Organization struct to inherit its fields. This is useful when you want to add custom fields or methods to the fake organization.
func NewOrganization ¶
func NewOrganization(db database.Database, options ...OrganizationOption) *FakeOrganization
NewOrganization creates a fake organization for testing.
func (*FakeOrganization) AddUser ¶
func (o *FakeOrganization) AddUser(db database.Database, userOptions ...UserOption) *FakeUser
AddUser creates a fake user under the organization.
func (*FakeOrganization) Delete ¶
func (o *FakeOrganization) Delete(db database.Database)
Delete deletes the organization from the database. Use it when you want to delete the organization after it's created. If you want to delete the organization during creation, use OrganizationDeleted option.
func (*FakeOrganization) FetchLatest ¶
func (o *FakeOrganization) FetchLatest(db database.Database) *FakeOrganization
FetchLatest fetches and returns the latest version of organization by querying the database.
func (*FakeOrganization) IsDeleted ¶
func (o *FakeOrganization) IsDeleted(db database.Database) bool
IsDeleted returns deleted status of the organization by querying the database.
func (*FakeOrganization) IsSuspended ¶
func (o *FakeOrganization) IsSuspended(db database.Database) bool
IsSuspended returns suspended status of the organization by querying the database.
type FakeUser ¶
FakeUser is a fake user for testing. It embeds the user.User struct to inherit its fields. This is useful when you want to add custom fields or methods to the fake user.
func NewUser ¶
func NewUser(db database.Database, orgID int64, options ...UserOption) *FakeUser
NewUser creates a fake user for testing.
func (*FakeUser) FetchLatest ¶
FetchLatest fetches and returns the latest version of user by querying the database.
type OrganizationOption ¶
type OrganizationOption func(*FakeOrganization) (*FakeOrganization, error)
OrganizationOption is a function that modifies an organization's default values.
func OrganizationDeleted ¶
func OrganizationDeleted() OrganizationOption
OrganizationDeleted sets deleted_at to current timestamp.
func OrganizationName ¶
func OrganizationName(name string) OrganizationOption
OrganizationName sets/overrides the default name of an organization.
func OrganizationSubdomain ¶
func OrganizationSubdomain(subdomain string) OrganizationOption
OrganizationSubdomain sets/overrides the default subdomain of an organization.
func OrganizationSuspended ¶
func OrganizationSuspended() OrganizationOption
OrganizationSuspended sets suspended_at to current timestamp.
type UserOption ¶
UserOption is a function that modifies a user's default values.
func UserDisabled ¶
func UserDisabled() UserOption
UserDisabled sets disabled_at to current timestamp.
func UserEmail ¶
func UserEmail(email string) UserOption
UserEmail sets/overrides the default email of a user.
func UserEmailNotVerified ¶
func UserEmailNotVerified() UserOption
UserEmailNotVerified sets is_email_verified to false.
func UserIsOwner ¶
func UserIsOwner() UserOption
UserIsOwner sets the user as the owner of the organization.
func UserPassword ¶
func UserPassword(password string) UserOption
UserPassword sets/overrides the default password of a user.
func UserWithoutToken ¶
func UserWithoutToken() UserOption
UserWithoutToken sets the API token to null.