Documentation ¶
Index ¶
- Constants
- func AssertResponseError(t *testing.T, resp *httptest.ResponseRecorder, statusCode int, ...)
- func AssertResponseFullErrorMessages(t *testing.T, resp *httptest.ResponseRecorder, statusCode int, ...)
- func GetAndDisposeTestClientsAndCollections(t *testing.T) (*mongo.Client, string, *mongo.Collection, *mongo.Collection)
- func GetDBAndCollections(t *testing.T, client *mongo.Client) (*mongo.Database, *mongo.Collection, *mongo.Collection)
- func GetMongoClient(t *testing.T) *mongo.Client
- func GetRandomName(n int) string
- func PopulateDBForTesting(t *testing.T, ctx context.Context, rolesCollection *mongo.Collection, ...)
Constants ¶
View Source
const LocalhostMongoDB = "localhost:27017"
Variables ¶
This section is empty.
Functions ¶
func AssertResponseError ¶
func GetAndDisposeTestClientsAndCollections ¶
func GetAndDisposeTestClientsAndCollections(t *testing.T) (*mongo.Client, string, *mongo.Collection, *mongo.Collection)
GetAndDisposeTestCollection returns a collection from a random database. The function performs test clean up by dropping the database and closing MongoDB client connection.
func GetDBAndCollections ¶
func GetDBAndCollections(t *testing.T, client *mongo.Client) (*mongo.Database, *mongo.Collection, *mongo.Collection)
GetDBAndCollections returns a random database and collection. The function does not perform any cleanup, you have to manually disconnect from the client.
func GetMongoClient ¶
GetMongoClient returns a mongodb client. The function does not perform any cleanup, you have to manually disconnect from the client.
func GetRandomName ¶
func PopulateDBForTesting ¶
func PopulateDBForTesting( t *testing.T, ctx context.Context, rolesCollection *mongo.Collection, bindingsCollection *mongo.Collection, )
#nosec G104 -- Ignored errors
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.