82 lines
1.8 KiB
Go
82 lines
1.8 KiB
Go
|
|
// Code generated by BobGen psql v0.41.1. DO NOT EDIT.
|
||
|
|
// This file is meant to be re-generated in place and/or deleted at any time.
|
||
|
|
|
||
|
|
package factory
|
||
|
|
|
||
|
|
import (
|
||
|
|
"context"
|
||
|
|
"testing"
|
||
|
|
)
|
||
|
|
|
||
|
|
func TestCreateGooseDBVersion(t *testing.T) {
|
||
|
|
if testDB == nil {
|
||
|
|
t.Skip("skipping test, no DSN provided")
|
||
|
|
}
|
||
|
|
|
||
|
|
ctx, cancel := context.WithCancel(t.Context())
|
||
|
|
t.Cleanup(cancel)
|
||
|
|
|
||
|
|
tx, err := testDB.Begin(ctx)
|
||
|
|
if err != nil {
|
||
|
|
t.Fatalf("Error starting transaction: %v", err)
|
||
|
|
}
|
||
|
|
|
||
|
|
defer func() {
|
||
|
|
if err := tx.Rollback(ctx); err != nil {
|
||
|
|
t.Fatalf("Error rolling back transaction: %v", err)
|
||
|
|
}
|
||
|
|
}()
|
||
|
|
|
||
|
|
if _, err := New().NewGooseDBVersionWithContext(ctx).Create(ctx, tx); err != nil {
|
||
|
|
t.Fatalf("Error creating GooseDBVersion: %v", err)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func TestCreateOrganization(t *testing.T) {
|
||
|
|
if testDB == nil {
|
||
|
|
t.Skip("skipping test, no DSN provided")
|
||
|
|
}
|
||
|
|
|
||
|
|
ctx, cancel := context.WithCancel(t.Context())
|
||
|
|
t.Cleanup(cancel)
|
||
|
|
|
||
|
|
tx, err := testDB.Begin(ctx)
|
||
|
|
if err != nil {
|
||
|
|
t.Fatalf("Error starting transaction: %v", err)
|
||
|
|
}
|
||
|
|
|
||
|
|
defer func() {
|
||
|
|
if err := tx.Rollback(ctx); err != nil {
|
||
|
|
t.Fatalf("Error rolling back transaction: %v", err)
|
||
|
|
}
|
||
|
|
}()
|
||
|
|
|
||
|
|
if _, err := New().NewOrganizationWithContext(ctx).Create(ctx, tx); err != nil {
|
||
|
|
t.Fatalf("Error creating Organization: %v", err)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func TestCreateUser(t *testing.T) {
|
||
|
|
if testDB == nil {
|
||
|
|
t.Skip("skipping test, no DSN provided")
|
||
|
|
}
|
||
|
|
|
||
|
|
ctx, cancel := context.WithCancel(t.Context())
|
||
|
|
t.Cleanup(cancel)
|
||
|
|
|
||
|
|
tx, err := testDB.Begin(ctx)
|
||
|
|
if err != nil {
|
||
|
|
t.Fatalf("Error starting transaction: %v", err)
|
||
|
|
}
|
||
|
|
|
||
|
|
defer func() {
|
||
|
|
if err := tx.Rollback(ctx); err != nil {
|
||
|
|
t.Fatalf("Error rolling back transaction: %v", err)
|
||
|
|
}
|
||
|
|
}()
|
||
|
|
|
||
|
|
if _, err := New().NewUserWithContext(ctx).Create(ctx, tx); err != nil {
|
||
|
|
t.Fatalf("Error creating User: %v", err)
|
||
|
|
}
|
||
|
|
}
|