...

Source file src/github.com/gin-contrib/sessions/gorm/gorm_test.go

Documentation: github.com/gin-contrib/sessions/gorm

     1  // +build go1.13
     2  
     3  package gorm
     4  
     5  import (
     6  	"testing"
     7  
     8  	"github.com/gin-contrib/sessions"
     9  	"github.com/gin-contrib/sessions/tester"
    10  	"gorm.io/driver/sqlite"
    11  	"gorm.io/gorm"
    12  )
    13  
    14  var newStore = func(_ *testing.T) sessions.Store {
    15  	db, err := gorm.Open(sqlite.Open("test.db"), &gorm.Config{})
    16  	if err != nil {
    17  		panic(err)
    18  	}
    19  	return NewStore(db, true, []byte("secret"))
    20  }
    21  
    22  func TestGorm_SessionGetSet(t *testing.T) {
    23  	tester.GetSet(t, newStore)
    24  }
    25  
    26  func TestGorm_SessionDeleteKey(t *testing.T) {
    27  	tester.DeleteKey(t, newStore)
    28  }
    29  
    30  func TestGorm_SessionFlashes(t *testing.T) {
    31  	tester.Flashes(t, newStore)
    32  }
    33  
    34  func TestGorm_SessionClear(t *testing.T) {
    35  	tester.Clear(t, newStore)
    36  }
    37  
    38  func TestGorm_SessionOptions(t *testing.T) {
    39  	tester.Options(t, newStore)
    40  }
    41  
    42  func TestGorm_SessionMany(t *testing.T) {
    43  	tester.Many(t, newStore)
    44  }
    45  

View as plain text