mock

package
v0.0.29 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeOnboardingRepository

type FakeOnboardingRepository struct {
	AddRoleToUserfn func(ctx context.Context, phone string, role profileutils.RoleType) error

	StageProfileNudgeFn func(ctx context.Context, nudge *feedlib.Nudge) error

	CreateUserProfileFn func(ctx context.Context, phoneNumber, uid string) (*profileutils.UserProfile, error)

	CreateDetailedUserProfileFn func(ctx context.Context, phoneNumber string, profile profileutils.UserProfile) (*profileutils.UserProfile, error)

	// fetches a user profile by uid
	GetUserProfileByUIDFn func(ctx context.Context, uid string, suspended bool) (*profileutils.UserProfile, error)

	// fetches user profile by email
	GetUserProfileByPhoneOrEmailFn func(ctx context.Context, payload *dto.RetrieveUserProfileInput) (*profileutils.UserProfile, error)

	// fetches a user profile by id
	GetUserProfileByIDFn func(ctx context.Context, id string, suspended bool) (*profileutils.UserProfile, error)

	// fetches a user profile by phone number
	GetUserProfileByPhoneNumberFn func(ctx context.Context, phoneNumber string, suspended bool) (*profileutils.UserProfile, error)

	// fetches a user profile by primary phone number
	GetUserProfileByPrimaryPhoneNumberFn func(ctx context.Context, phoneNumber string, suspended bool) (*profileutils.UserProfile, error)

	// checks if a specific phone number has already been registered to another user
	CheckIfPhoneNumberExistsFn func(ctx context.Context, phone string) (bool, error)

	CheckIfEmailExistsFn func(ctx context.Context, email string) (bool, error)

	// checks if a specific username has already been registered to another user
	CheckIfUsernameExistsFn func(ctx context.Context, phone string) (bool, error)

	GenerateAuthCredentialsForAnonymousUserFn func(ctx context.Context) (*profileutils.AuthCredentialResponse, error)

	GenerateAuthCredentialsFn func(ctx context.Context, phone string, profile *profileutils.UserProfile) (*profileutils.AuthCredentialResponse, error)

	FetchAdminUsersFn func(ctx context.Context) ([]*profileutils.UserProfile, error)
	CheckIfAdminFn    func(profile *profileutils.UserProfile) bool

	// removes user completely. This should be used only under testing environment
	PurgeUserByPhoneNumberFn func(ctx context.Context, phone string) error

	HardResetSecondaryPhoneNumbersFn func(ctx context.Context, profile *profileutils.UserProfile, phoneNumbers []string) error

	HardResetSecondaryEmailAddressFn func(ctx context.Context, profile *profileutils.UserProfile, newSecondaryEmails []string) error

	// PINs
	GetPINByProfileIDFn func(ctx context.Context, ProfileID string) (*domain.PIN, error)

	// Record post visit survey
	RecordPostVisitSurveyFn func(ctx context.Context, input dto.PostVisitSurveyInput, UID string) error

	// User Pin methods
	SavePINFn   func(ctx context.Context, pin *domain.PIN) (bool, error)
	UpdatePINFn func(ctx context.Context, id string, pin *domain.PIN) (bool, error)

	ExchangeRefreshTokenForIDTokenFn func(
		ctx context.Context,
		token string,
	) (*profileutils.AuthCredentialResponse, error)

	GetOrCreatePhoneNumberUserFn func(
		ctx context.Context,
		phone string,
	) (*dto.CreatedUserResponse, error)

	GetUserProfileAttributesFn func(
		ctx context.Context,
		UIDs []string,
		attribute string,
	) (map[string][]string, error)

	CheckIfExperimentParticipantFn func(ctx context.Context, profileID string) (bool, error)

	AddUserAsExperimentParticipantFn func(ctx context.Context, profile *profileutils.UserProfile) (bool, error)

	RemoveUserAsExperimentParticipantFn func(ctx context.Context, profile *profileutils.UserProfile) (bool, error)

	GetUserCommunicationsSettingsFn func(ctx context.Context, profileID string) (*profileutils.UserCommunicationsSetting, error)

	SetUserCommunicationsSettingsFn func(ctx context.Context, profileID string,
		allowWhatsApp *bool, allowTextSms *bool, allowPush *bool, allowEmail *bool) (*profileutils.UserCommunicationsSetting, error)

	// Userprofile
	UpdateUserNameFn                func(ctx context.Context, id string, phoneNumber string) error
	UpdatePrimaryPhoneNumberFn      func(ctx context.Context, id string, phoneNumber string) error
	UpdatePrimaryEmailAddressFn     func(ctx context.Context, id string, emailAddress string) error
	UpdateSecondaryPhoneNumbersFn   func(ctx context.Context, id string, phoneNumbers []string) error
	UpdateSecondaryEmailAddressesFn func(ctx context.Context, id string, emailAddresses []string) error
	UpdateUserRoleIDsFn             func(ctx context.Context, id string, roleIDs []string) error
	UpdateSuspendedFn               func(ctx context.Context, id string, status bool) error
	UpdatePhotoUploadIDFn           func(ctx context.Context, id string, uploadID string) error
	UpdatePushTokensFn              func(ctx context.Context, id string, pushToken []string) error
	UpdatePermissionsFn             func(ctx context.Context, id string, perms []profileutils.PermissionType) error
	UpdateRoleFn                    func(ctx context.Context, id string, role profileutils.RoleType) error
	UpdateBioDataFn                 func(ctx context.Context, id string, data profileutils.BioData) error
	UpdateVerifiedIdentifiersFn     func(ctx context.Context, id string, identifiers []profileutils.VerifiedIdentifier) error
	UpdateVerifiedUIDSFn            func(ctx context.Context, id string, uids []string) error
	UpdateAddressesFn               func(ctx context.Context, id string, address profileutils.Address, addressType enumutils.AddressType) error
	ListUserProfilesFn              func(ctx context.Context, role profileutils.RoleType) ([]*profileutils.UserProfile, error)
	UpdateOptOutFn                  func(ctx context.Context, option string, phoneNumber string) error
	UpdateFavNavActionsFn           func(ctx context.Context, id string, favActions []string) error //roles
	CreateRoleFn                    func(ctx context.Context, profileID string, role dto.RoleInput) (*profileutils.Role, error)
	GetAllRolesFn                   func(ctx context.Context) (*[]profileutils.Role, error)
	UpdateRoleDetailsFn             func(ctx context.Context, profileID string, role profileutils.Role) (*profileutils.Role, error)
	GetRolesByIDsFn                 func(ctx context.Context, roleIDs []string) (*[]profileutils.Role, error)
	GetRoleByIDFn                   func(ctx context.Context, roleID string) (*profileutils.Role, error)
	GetRoleByNameFn                 func(ctx context.Context, roleName string) (*profileutils.Role, error)
	CheckIfRoleNameExistsFn         func(ctx context.Context, name string) (bool, error)
	DeleteRoleFn                    func(ctx context.Context, roleID string) (bool, error)
	CheckIfUserHasPermissionFn      func(ctx context.Context, UID string, requiredPermission profileutils.Permission) (bool, error)
	UpdateUserProfileEmailFn        func(ctx context.Context, phone string, email string) error
	GetUserProfilesByRoleIDFn       func(ctx context.Context, role string) ([]*profileutils.UserProfile, error)
	SaveRoleRevocationFn            func(ctx context.Context, userID string, revocation dto.RoleRevocationInput) error
}

FakeOnboardingRepository is a mock onboarding repository.

func (*FakeOnboardingRepository) AddRoleToUser

func (f *FakeOnboardingRepository) AddRoleToUser(
	ctx context.Context,
	phone string,
	role profileutils.RoleType,
) error

AddRoleToUser ...

func (*FakeOnboardingRepository) AddUserAsExperimentParticipant

func (f *FakeOnboardingRepository) AddUserAsExperimentParticipant(
	ctx context.Context,
	profile *profileutils.UserProfile,
) (bool, error)

AddUserAsExperimentParticipant ...

func (*FakeOnboardingRepository) CheckIfAdmin

func (f *FakeOnboardingRepository) CheckIfAdmin(profile *profileutils.UserProfile) bool

CheckIfAdmin ...

func (*FakeOnboardingRepository) CheckIfEmailExists

func (f *FakeOnboardingRepository) CheckIfEmailExists(
	ctx context.Context,
	email string,
) (bool, error)

CheckIfEmailExists ...

func (*FakeOnboardingRepository) CheckIfExperimentParticipant

func (f *FakeOnboardingRepository) CheckIfExperimentParticipant(
	ctx context.Context,
	profileID string,
) (bool, error)

CheckIfExperimentParticipant ...

func (*FakeOnboardingRepository) CheckIfPhoneNumberExists

func (f *FakeOnboardingRepository) CheckIfPhoneNumberExists(
	ctx context.Context,
	phone string,
) (bool, error)

CheckIfPhoneNumberExists checks if a specific phone number has already been registered to another user

func (*FakeOnboardingRepository) CheckIfRoleNameExists

func (f *FakeOnboardingRepository) CheckIfRoleNameExists(
	ctx context.Context,
	name string,
) (bool, error)

CheckIfRoleNameExists ...

func (*FakeOnboardingRepository) CheckIfUserHasPermission added in v0.0.2

func (f *FakeOnboardingRepository) CheckIfUserHasPermission(
	ctx context.Context,
	UID string,
	requiredPermission profileutils.Permission,
) (bool, error)

CheckIfUserHasPermission ...

func (*FakeOnboardingRepository) CheckIfUsernameExists

func (f *FakeOnboardingRepository) CheckIfUsernameExists(
	ctx context.Context,
	phone string,
) (bool, error)

CheckIfUsernameExists checks if a specific username has already been registered to another user

func (*FakeOnboardingRepository) CreateDetailedUserProfile

func (f *FakeOnboardingRepository) CreateDetailedUserProfile(
	ctx context.Context,
	phoneNumber string,
	profile profileutils.UserProfile,
) (*profileutils.UserProfile, error)

CreateDetailedUserProfile ...

func (*FakeOnboardingRepository) CreateRole

func (f *FakeOnboardingRepository) CreateRole(
	ctx context.Context,
	profileID string,
	input dto.RoleInput,
) (*profileutils.Role, error)

CreateRole ...

func (*FakeOnboardingRepository) CreateUserProfile

func (f *FakeOnboardingRepository) CreateUserProfile(
	ctx context.Context,
	phoneNumber, uid string,
) (*profileutils.UserProfile, error)

CreateUserProfile ...

func (*FakeOnboardingRepository) DeleteRole added in v0.0.2

func (f *FakeOnboardingRepository) DeleteRole(ctx context.Context, roleID string) (bool, error)

DeleteRole ...

func (*FakeOnboardingRepository) ExchangeRefreshTokenForIDToken

func (f *FakeOnboardingRepository) ExchangeRefreshTokenForIDToken(
	ctx context.Context,
	token string,
) (*profileutils.AuthCredentialResponse, error)

ExchangeRefreshTokenForIDToken ...

func (*FakeOnboardingRepository) FetchAdminUsers

func (f *FakeOnboardingRepository) FetchAdminUsers(
	ctx context.Context,
) ([]*profileutils.UserProfile, error)

FetchAdminUsers ...

func (*FakeOnboardingRepository) GenerateAuthCredentials

func (f *FakeOnboardingRepository) GenerateAuthCredentials(
	ctx context.Context,
	phone string,
	profile *profileutils.UserProfile,
) (*profileutils.AuthCredentialResponse, error)

GenerateAuthCredentials ...

func (*FakeOnboardingRepository) GenerateAuthCredentialsForAnonymousUser

func (f *FakeOnboardingRepository) GenerateAuthCredentialsForAnonymousUser(
	ctx context.Context,
) (*profileutils.AuthCredentialResponse, error)

GenerateAuthCredentialsForAnonymousUser ...

func (*FakeOnboardingRepository) GetAllRoles added in v0.0.2

func (f *FakeOnboardingRepository) GetAllRoles(
	ctx context.Context,
) (*[]profileutils.Role, error)

GetAllRoles ...

func (*FakeOnboardingRepository) GetOrCreatePhoneNumberUser

func (f *FakeOnboardingRepository) GetOrCreatePhoneNumberUser(ctx context.Context,
	phone string,
) (*dto.CreatedUserResponse, error)

GetOrCreatePhoneNumberUser ...

func (*FakeOnboardingRepository) GetPINByProfileID

func (f *FakeOnboardingRepository) GetPINByProfileID(
	ctx context.Context,
	ProfileID string,
) (*domain.PIN, error)

GetPINByProfileID PINs

func (*FakeOnboardingRepository) GetRoleByID

func (f *FakeOnboardingRepository) GetRoleByID(
	ctx context.Context,
	roleID string,
) (*profileutils.Role, error)

GetRoleByID ...

func (*FakeOnboardingRepository) GetRoleByName added in v0.0.2

func (f *FakeOnboardingRepository) GetRoleByName(ctx context.Context, roleName string) (*profileutils.Role, error)

GetRoleByName ...

func (*FakeOnboardingRepository) GetRolesByIDs

func (f *FakeOnboardingRepository) GetRolesByIDs(
	ctx context.Context,
	roleIDs []string,
) (*[]profileutils.Role, error)

GetRolesByIDs ...

func (*FakeOnboardingRepository) GetUserCommunicationsSettings

func (f *FakeOnboardingRepository) GetUserCommunicationsSettings(
	ctx context.Context,
	profileID string,
) (*profileutils.UserCommunicationsSetting, error)

GetUserCommunicationsSettings ...

func (*FakeOnboardingRepository) GetUserProfileAttributes

func (f *FakeOnboardingRepository) GetUserProfileAttributes(
	ctx context.Context,
	UIDs []string,
	attribute string,
) (map[string][]string, error)

GetUserProfileAttributes ...

func (*FakeOnboardingRepository) GetUserProfileByID

func (f *FakeOnboardingRepository) GetUserProfileByID(
	ctx context.Context,
	id string,
	suspended bool,
) (*profileutils.UserProfile, error)

GetUserProfileByID fetches a user profile by id

func (*FakeOnboardingRepository) GetUserProfileByPhoneNumber

func (f *FakeOnboardingRepository) GetUserProfileByPhoneNumber(
	ctx context.Context,
	phoneNumber string,
	suspended bool,
) (*profileutils.UserProfile, error)

GetUserProfileByPhoneNumber fetches a user profile by phone number

func (*FakeOnboardingRepository) GetUserProfileByPhoneOrEmail added in v0.0.2

func (f *FakeOnboardingRepository) GetUserProfileByPhoneOrEmail(ctx context.Context, payload *dto.RetrieveUserProfileInput) (*profileutils.UserProfile, error)

GetUserProfileByPhoneOrEmail fetches user profile by email or phone

func (*FakeOnboardingRepository) GetUserProfileByPrimaryPhoneNumber

func (f *FakeOnboardingRepository) GetUserProfileByPrimaryPhoneNumber(
	ctx context.Context,
	phoneNumber string,
	suspended bool,
) (*profileutils.UserProfile, error)

GetUserProfileByPrimaryPhoneNumber fetches a user profile by primary phone number

func (*FakeOnboardingRepository) GetUserProfileByUID

func (f *FakeOnboardingRepository) GetUserProfileByUID(
	ctx context.Context,
	uid string,
	suspended bool,
) (*profileutils.UserProfile, error)

GetUserProfileByUID fetches a user profile by uid

func (*FakeOnboardingRepository) GetUserProfilesByRoleID added in v0.0.2

func (f *FakeOnboardingRepository) GetUserProfilesByRoleID(ctx context.Context, role string) ([]*profileutils.UserProfile, error)

GetUserProfilesByRoleID ...

func (*FakeOnboardingRepository) HardResetSecondaryEmailAddress

func (f *FakeOnboardingRepository) HardResetSecondaryEmailAddress(
	ctx context.Context,
	profile *profileutils.UserProfile,
	newSecondaryEmails []string,
) error

HardResetSecondaryEmailAddress ...

func (*FakeOnboardingRepository) HardResetSecondaryPhoneNumbers

func (f *FakeOnboardingRepository) HardResetSecondaryPhoneNumbers(
	ctx context.Context,
	profile *profileutils.UserProfile,
	phoneNumbers []string,
) error

HardResetSecondaryPhoneNumbers ...

func (*FakeOnboardingRepository) ListUserProfiles

ListUserProfiles ...

func (*FakeOnboardingRepository) PurgeUserByPhoneNumber

func (f *FakeOnboardingRepository) PurgeUserByPhoneNumber(ctx context.Context, phone string) error

PurgeUserByPhoneNumber removes user completely. This should be used only under testing environment

func (*FakeOnboardingRepository) RecordPostVisitSurvey

func (f *FakeOnboardingRepository) RecordPostVisitSurvey(
	ctx context.Context,
	input dto.PostVisitSurveyInput,
	UID string,
) error

RecordPostVisitSurvey Record post visit survey

func (*FakeOnboardingRepository) RemoveUserAsExperimentParticipant

func (f *FakeOnboardingRepository) RemoveUserAsExperimentParticipant(
	ctx context.Context,
	profile *profileutils.UserProfile,
) (bool, error)

RemoveUserAsExperimentParticipant ...

func (*FakeOnboardingRepository) SavePIN

func (f *FakeOnboardingRepository) SavePIN(ctx context.Context, pin *domain.PIN) (bool, error)

SavePIN User Pin methods

func (*FakeOnboardingRepository) SaveRoleRevocation added in v0.0.2

func (f *FakeOnboardingRepository) SaveRoleRevocation(ctx context.Context, userID string, revocation dto.RoleRevocationInput) error

SaveRoleRevocation ...

func (*FakeOnboardingRepository) SetUserCommunicationsSettings

func (f *FakeOnboardingRepository) SetUserCommunicationsSettings(
	ctx context.Context,
	profileID string,
	allowWhatsApp *bool,
	allowTextSms *bool,
	allowPush *bool,
	allowEmail *bool,
) (*profileutils.UserCommunicationsSetting, error)

SetUserCommunicationsSettings ...

func (*FakeOnboardingRepository) StageProfileNudge

func (f *FakeOnboardingRepository) StageProfileNudge(
	ctx context.Context,
	nudge *feedlib.Nudge,
) error

StageProfileNudge ...

func (*FakeOnboardingRepository) UpdateAddresses

func (f *FakeOnboardingRepository) UpdateAddresses(
	ctx context.Context,
	id string,
	address profileutils.Address,
	addressType enumutils.AddressType,
) error

UpdateAddresses ...

func (*FakeOnboardingRepository) UpdateBioData

func (f *FakeOnboardingRepository) UpdateBioData(
	ctx context.Context,
	id string,
	data profileutils.BioData,
) error

UpdateBioData ...

func (*FakeOnboardingRepository) UpdateFavNavActions

func (f *FakeOnboardingRepository) UpdateFavNavActions(
	ctx context.Context,
	id string,
	favActions []string,
) error

UpdateFavNavActions ...

func (*FakeOnboardingRepository) UpdatePIN

func (f *FakeOnboardingRepository) UpdatePIN(
	ctx context.Context,
	id string,
	pin *domain.PIN,
) (bool, error)

UpdatePIN ...

func (*FakeOnboardingRepository) UpdatePermissions

func (f *FakeOnboardingRepository) UpdatePermissions(
	ctx context.Context,
	id string,
	perms []profileutils.PermissionType,
) error

UpdatePermissions ...

func (*FakeOnboardingRepository) UpdatePhotoUploadID

func (f *FakeOnboardingRepository) UpdatePhotoUploadID(
	ctx context.Context,
	id string,
	uploadID string,
) error

UpdatePhotoUploadID ...

func (*FakeOnboardingRepository) UpdatePrimaryEmailAddress

func (f *FakeOnboardingRepository) UpdatePrimaryEmailAddress(
	ctx context.Context,
	id string,
	emailAddress string,
) error

UpdatePrimaryEmailAddress ...

func (*FakeOnboardingRepository) UpdatePrimaryPhoneNumber

func (f *FakeOnboardingRepository) UpdatePrimaryPhoneNumber(
	ctx context.Context,
	id string,
	phoneNumber string,
) error

UpdatePrimaryPhoneNumber ...

func (*FakeOnboardingRepository) UpdatePushTokens

func (f *FakeOnboardingRepository) UpdatePushTokens(
	ctx context.Context,
	id string,
	pushToken []string,
) error

UpdatePushTokens ...

func (*FakeOnboardingRepository) UpdateRole

func (f *FakeOnboardingRepository) UpdateRole(
	ctx context.Context,
	id string,
	role profileutils.RoleType,
) error

UpdateRole ...

func (*FakeOnboardingRepository) UpdateRoleDetails

func (f *FakeOnboardingRepository) UpdateRoleDetails(
	ctx context.Context,
	profileID string,
	role profileutils.Role,
) (*profileutils.Role, error)

UpdateRoleDetails ...

func (*FakeOnboardingRepository) UpdateSecondaryEmailAddresses

func (f *FakeOnboardingRepository) UpdateSecondaryEmailAddresses(
	ctx context.Context,
	id string,
	emailAddresses []string,
) error

UpdateSecondaryEmailAddresses ...

func (*FakeOnboardingRepository) UpdateSecondaryPhoneNumbers

func (f *FakeOnboardingRepository) UpdateSecondaryPhoneNumbers(
	ctx context.Context,
	id string,
	phoneNumbers []string,
) error

UpdateSecondaryPhoneNumbers ...

func (*FakeOnboardingRepository) UpdateSuspended

func (f *FakeOnboardingRepository) UpdateSuspended(
	ctx context.Context,
	id string,
	status bool,
) error

UpdateSuspended ...

func (*FakeOnboardingRepository) UpdateUserName

func (f *FakeOnboardingRepository) UpdateUserName(
	ctx context.Context,
	id string,
	phoneNumber string,
) error

UpdateUserName ...

func (*FakeOnboardingRepository) UpdateUserProfileEmail added in v0.0.2

func (f *FakeOnboardingRepository) UpdateUserProfileEmail(ctx context.Context, phone string, email string) error

UpdateUserProfileEmail ...

func (*FakeOnboardingRepository) UpdateUserRoleIDs added in v0.0.2

func (f *FakeOnboardingRepository) UpdateUserRoleIDs(
	ctx context.Context,
	id string,
	roleIDs []string,
) error

UpdateUserRoleIDs ...

func (*FakeOnboardingRepository) UpdateVerifiedIdentifiers

func (f *FakeOnboardingRepository) UpdateVerifiedIdentifiers(
	ctx context.Context,
	id string,
	identifiers []profileutils.VerifiedIdentifier,
) error

UpdateVerifiedIdentifiers ...

func (*FakeOnboardingRepository) UpdateVerifiedUIDS

func (f *FakeOnboardingRepository) UpdateVerifiedUIDS(
	ctx context.Context,
	id string,
	uids []string,
) error

UpdateVerifiedUIDS ...

Jump to

Keyboard shortcuts

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