appstoretest

package
v0.1.35 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package appstoretest provides a shared contract test suite for all AppRegistrationStore implementations. Each backend (inmem, fs, gorm) calls these tests with its own factory function. Mirrors keystoretest.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunAll

func RunAll(t *testing.T, factory Factory)

RunAll runs the complete AppRegistrationStore test suite against the provided factory.

func TestAllFieldsRoundTrip

func TestAllFieldsRoundTrip(t *testing.T, factory Factory)

TestAllFieldsRoundTrip verifies that every field on AppRegistration survives a SaveApp/GetApp round-trip. Catches backend serialization bugs (e.g., GORM forgetting to JSON-encode slice fields).

func TestDeleteApp

func TestDeleteApp(t *testing.T, factory Factory)

TestDeleteApp verifies that DeleteApp removes the registration and subsequent GetApp returns ErrAppNotFound.

func TestDeleteNonexistent

func TestDeleteNonexistent(t *testing.T, factory Factory)

TestDeleteNonexistent verifies that deleting a missing client_id returns ErrAppNotFound, matching KeyStorage.DeleteKey semantics.

func TestListApps

func TestListApps(t *testing.T, factory Factory)

TestListApps verifies that ListApps returns every saved registration.

func TestListAppsEmpty

func TestListAppsEmpty(t *testing.T, factory Factory)

TestListAppsEmpty verifies that ListApps on a fresh store returns an empty slice (not an error).

func TestNotFound

func TestNotFound(t *testing.T, factory Factory)

TestNotFound verifies that GetApp on a missing client_id returns ErrAppNotFound.

func TestOverwriteApp

func TestOverwriteApp(t *testing.T, factory Factory)

TestOverwriteApp verifies that SaveApp on an existing client_id replaces the stored registration with the new metadata.

func TestPersistence

func TestPersistence(t *testing.T, factory Factory)

TestPersistence verifies that a saved registration is visible to subsequent reads from the same store handle. For persistent backends (FS, GORM) this catches write-buffering bugs; for InMem it is trivially true.

func TestSaveAndGet

func TestSaveAndGet(t *testing.T, factory Factory)

TestSaveAndGet verifies that SaveApp followed by GetApp returns the saved registration.

Types

type Factory

type Factory func(t *testing.T) core.AppRegistrationStore

Factory creates a fresh AppRegistrationStore for each test.

Jump to

Keyboard shortcuts

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