storetest

package
v3.24.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateSchema added in v3.19.0

func CreateSchema(db *sql.DB, schemaName string) error

func DropSchema added in v3.19.0

func DropSchema(db *sql.DB, schemaName string) error

func GetDSN added in v3.19.0

func GetDSN(defaultDB string) *url.URL

func GetSchemaDSN added in v3.19.0

func GetSchemaDSN(base *url.URL, schemaName string) *url.URL

Types

type EntityAPIKey

type EntityAPIKey struct {
	EntityIdentifiers *ttnpb.EntityIdentifiers
	APIKey            *ttnpb.APIKey
}

EntityAPIKey is an API key for an entity.

type EntityCollaborator

type EntityCollaborator struct {
	EntityIdentifiers *ttnpb.EntityIdentifiers
	Collaborator      *ttnpb.Collaborator
}

EntityCollaborator is a collaborator on an entity.

type Population

type Population struct {
	Applications  []*ttnpb.Application
	Clients       []*ttnpb.Client
	EndDevices    []*ttnpb.EndDevice
	Gateways      []*ttnpb.Gateway
	Organizations []*ttnpb.Organization
	Users         []*ttnpb.User
	UserSessions  []*ttnpb.UserSession

	APIKeys     []*EntityAPIKey
	Memberships []*EntityCollaborator
}

Population is a collection of store entities.

func (*Population) NewAPIKey

func (p *Population) NewAPIKey(entityID *ttnpb.EntityIdentifiers, rights ...ttnpb.Right) (original, stored *ttnpb.APIKey)

NewAPIKey adds a new API key to the population and returns it. The returned API key can not be modified and will not have its CreatedAt/UpdatedAt fields populated.

func (*Population) NewApplication

func (p *Population) NewApplication(owner *ttnpb.OrganizationOrUserIdentifiers) *ttnpb.Application

NewApplication adds a new application to the population and returns it. The returned application can be modified until Population.Populate is called.

func (*Population) NewClient

NewClient adds a new client to the population and returns it. The returned client can be modified until Population.Populate is called.

func (*Population) NewEndDevice

func (p *Population) NewEndDevice(application *ttnpb.ApplicationIdentifiers) *ttnpb.EndDevice

NewEndDevice adds a new end device to the population and returns it. The returned end device can be modified until Population.Populate is called.

func (*Population) NewGateway

NewGateway adds a new gateway to the population and returns it. The returned gateway can be modified until Population.Populate is called.

func (*Population) NewMembership

func (p *Population) NewMembership(memberID *ttnpb.OrganizationOrUserIdentifiers, entityID *ttnpb.EntityIdentifiers, rights ...ttnpb.Right)

NewMembership adds a new membership to the population.

func (*Population) NewOrganization

func (p *Population) NewOrganization(owner *ttnpb.OrganizationOrUserIdentifiers) *ttnpb.Organization

NewOrganization adds a new organization to the population and returns it. The returned organization can be modified until Population.Populate is called.

func (*Population) NewUser

func (p *Population) NewUser() *ttnpb.User

NewUser adds a new user to the population and returns it. The returned user can be modified until Population.Populate is called.

func (*Population) NewUserSession

func (p *Population) NewUserSession(user *ttnpb.UserIdentifiers) *ttnpb.UserSession

NewUserSession adds a new user session to the population and returns it. The returned user session can not be modified and will not have its CreatedAt/UpdatedAt fields populated.

func (*Population) Populate

func (p *Population) Populate(ctx context.Context, st interface{}) error

Populate creates the population in the database. After calling Populate, the entities in the population should no longer be modified.

type Store

type Store interface {
	Init(ctx context.Context) error
	Close() error
}

type StoreTest

type StoreTest struct {
	// contains filtered or unexported fields
}

func New

func New(t *testing.T, newStore func(t *testing.T, dsn *url.URL) Store) *StoreTest

func (*StoreTest) DestroyDB

func (s *StoreTest) DestroyDB(t *testing.T, assertClean bool, exceptions ...string)

func (*StoreTest) PrepareDB

func (s *StoreTest) PrepareDB(t *testing.T) Store

func (*StoreTest) TestAPIKeyStoreCRUD

func (st *StoreTest) TestAPIKeyStoreCRUD(t *T)

func (*StoreTest) TestAPIKeyStorePagination added in v3.18.0

func (st *StoreTest) TestAPIKeyStorePagination(t *T)

func (*StoreTest) TestApplicationStoreCRUD

func (st *StoreTest) TestApplicationStoreCRUD(t *T)

func (*StoreTest) TestApplicationStorePagination added in v3.18.0

func (st *StoreTest) TestApplicationStorePagination(t *T)

func (*StoreTest) TestClientStoreCRUD

func (st *StoreTest) TestClientStoreCRUD(t *T)

func (*StoreTest) TestClientStorePagination added in v3.18.0

func (st *StoreTest) TestClientStorePagination(t *T)

func (*StoreTest) TestContactInfoStoreCRUD

func (st *StoreTest) TestContactInfoStoreCRUD(t *T)

func (*StoreTest) TestDeletedEntities

func (st *StoreTest) TestDeletedEntities(t *T)

func (*StoreTest) TestEUIStore

func (st *StoreTest) TestEUIStore(t *T)

func (*StoreTest) TestEndDeviceBatchUpdate added in v3.19.0

func (st *StoreTest) TestEndDeviceBatchUpdate(t *T)

func (*StoreTest) TestEndDeviceCAC added in v3.21.2

func (st *StoreTest) TestEndDeviceCAC(t *T)

func (*StoreTest) TestEndDeviceStoreCRUD

func (st *StoreTest) TestEndDeviceStoreCRUD(t *T)

func (*StoreTest) TestEndDeviceStorePagination added in v3.18.0

func (st *StoreTest) TestEndDeviceStorePagination(t *T)

func (*StoreTest) TestEntitySearch

func (st *StoreTest) TestEntitySearch(t *T)

func (*StoreTest) TestEntitySearchPagination added in v3.18.0

func (st *StoreTest) TestEntitySearchPagination(t *T)

func (*StoreTest) TestGatewayStoreCRUD

func (st *StoreTest) TestGatewayStoreCRUD(t *T)

func (*StoreTest) TestGatewayStorePagination added in v3.18.0

func (st *StoreTest) TestGatewayStorePagination(t *T)

func (*StoreTest) TestInvitationStore

func (st *StoreTest) TestInvitationStore(t *T)

func (*StoreTest) TestInvitationStorePagination added in v3.18.0

func (st *StoreTest) TestInvitationStorePagination(t *T)

func (*StoreTest) TestLoginTokenStore

func (st *StoreTest) TestLoginTokenStore(t *T)

func (*StoreTest) TestMembershipStoreCRUD

func (st *StoreTest) TestMembershipStoreCRUD(t *T)

func (*StoreTest) TestMembershipStorePagination added in v3.18.0

func (st *StoreTest) TestMembershipStorePagination(t *T)

func (*StoreTest) TestNotificationStore added in v3.19.0

func (st *StoreTest) TestNotificationStore(t *T)

func (*StoreTest) TestOAuthStore

func (st *StoreTest) TestOAuthStore(t *T)

func (*StoreTest) TestOAuthStorePagination added in v3.18.0

func (st *StoreTest) TestOAuthStorePagination(t *T)

func (*StoreTest) TestOrganizationStoreCRUD

func (st *StoreTest) TestOrganizationStoreCRUD(t *T)

func (*StoreTest) TestOrganizationStorePagination added in v3.18.0

func (st *StoreTest) TestOrganizationStorePagination(t *T)

func (*StoreTest) TestUserSessionStore

func (st *StoreTest) TestUserSessionStore(t *T)

func (*StoreTest) TestUserSessionStorePagination added in v3.18.0

func (st *StoreTest) TestUserSessionStorePagination(t *T)

func (*StoreTest) TestUserStoreCRUD

func (st *StoreTest) TestUserStoreCRUD(t *T)

func (*StoreTest) TestUserStorePagination added in v3.18.0

func (st *StoreTest) TestUserStorePagination(t *T)

Jump to

Keyboard shortcuts

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