mirror of
https://github.com/safing/portbase
synced 2026-05-01 21:21:23 +00:00
Rename model.Model to record.Record
This commit is contained in:
parent
9b7365376c
commit
d76bfd55dc
23 changed files with 31 additions and 619 deletions
35
database/record/meta-gencode_test.go
Normal file
35
database/record/meta-gencode_test.go
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
package model
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
genCodeTestMeta = &Meta{
|
||||
created: time.Now().Unix(),
|
||||
modified: time.Now().Unix(),
|
||||
expires: time.Now().Unix(),
|
||||
deleted: time.Now().Unix(),
|
||||
secret: true,
|
||||
cronjewel: true,
|
||||
}
|
||||
)
|
||||
|
||||
func TestGenCode(t *testing.T) {
|
||||
encoded, err := genCodeTestMeta.GenCodeMarshal(nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
new := &Meta{}
|
||||
_, err = new.GenCodeUnmarshal(encoded)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(genCodeTestMeta, new) {
|
||||
t.Errorf("objects are not equal, got: %v", new)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue